Thursday, February 5, 2015

Problem Solving Phase

The key to solving a problem is understanding what is being asked to do, logic how to do it, and get it done.



The Five (5) Steps in Problem Solving Phase
  1. Define the problem
  2. Find a solution
  3. Evaluate alternate solutions
  4. Choose the most efficient solution and write an algorithm
  5. Test algorithm for correctness
To define the problem, programmers use a defining diagram, commonly referred to as an IPO table. 
Defining Diagram - a three column table that separates a given problem into Input, Processing, and Output.

The IPO table does not solve the problem; it simply outline the procedural steps.  Calculations are not shown in the table.  

Example of IPO Table
 
Problem: Calculate and output the total cost of three items.


Input
Processing
Output
Cost1
Cost2
Cost3
1.   Read Cost1, Cost2, Cost3
2.   Calculate Total
3.   Print Total
Total

Input
We have assigned a name (variable name) to each of the cost values that will be entered.
we will learn more about variables at a later point.

Processing
Each processing step is numbered.  
The processing steps are what steps the computer will have to do to solve the problem.
The first processing step is always to (read) the variables that are inputted.
The final processing step is always to display (or print) was is to be outputted.

Output
Anything that needs to be displayed or the result of what is being asked to solve

You try one...
Prepare the defining diagram for the following problem:  Calculate and output the average of two quiz grades.  (hint...there are four processing steps)

No comments:

Post a Comment