Tutorial 2
Beginning the ProblemSolving Process
This tutorial stresses the importance of proper design in the programming process. It also shows where design fits in the overall process of problemsolving. Different methods of designing the solution to the problem are shown (flowcharts & pseudocode). The author does an excellent job with her examples of implementing the problemsolving process.
After completing the tutorial, the student will be able to:
 Explain the problemsolving process used to create a computer program
 Analyze a problem
 Complete an IPO chart
 Plan an algorithm using pseudocode and flowcharts
 Deskcheck an algorithm
Review algorithm definition
Remember from Tutorial 1 that an algorithm is the stepbystep instructions that accomplish a task. Another definition of an algorithm could be a series of finite steps that solve a problem. Remember that an algorithm should not consist of an infinite number of steps.
IPO chart
Programmers use IPO (Input, Processing, Output) charts to organize and summarize the results of a problem analysis. After determining what output is expected from the problem solution, you can then ask what information will the computer need to know in order to either print, display, or store the output items, therefore determining the input needed. Once determining what input you have and what output you want, the processing portion of the chart can be determined. Intermediate processing items (other than input or output) would be determined along with the algorithm.
ProblemSolving Process
Following a proper problemsolving process is critical to successfully completing a task. The problemsolving process presented by the author is a sixstep process. These six steps are as follows:
1. Analyze the problem
2. Plan the algorithm
3. Deskcheck the algorithm
4. Code the algorithm into a program
5. Deskcheck the program
6. Evaluate and modify (if necessary) the program
The first step in the problemsolving process is the most import, which is analyzing the problem. For if the problem is not analyzed and determined properly, you may be solving a different problem than you intended to do. In analyzing the problem the Input and Output section on the IPO chart can be used to determine what you have and what you want.
After properly analyzing the problem a good design solution is essential to the success of solving the task at hand. First the IPO chart can be further utilized by identifying processing items, which are intermediate values used to process the input and output. Once these processing items are determined an algorithm can be created using one of two basic methods: flowcharts and pseudocode. A flowchart uses symbols to direct flow and structures, while pseudocode is an Englishlike version of a flowchart (like a table of contents).
Once an algorithm has been established it should be deskchecked. In order to do this a set of sample data must be created. Then the sample data can be used to test the algorithm verifying order and accuracy of the steps.
After determining that the algorithm is a viable one, the algorithm must be converted into a computer program. Note that up until this point that we did not have to know which programming language was being used. Before converting the algorithm into an actual program, one must understand the syntax and control structures used in the language that has been selected.
Just like the algorithm was deskchecked, the first draft of the program should also be deskchecked. Once again a set of sample data must be created, and a walk through of the code be conducted to verify the order and accuracy of steps.
Once the deskcheck of the program has been conducted one must evaluate and modify the program if necessary. Even though a great deal of time was put into the problemsolving process up to this point, some details could have still been overlooked. Therefore based upon the desk checking that was performed once the program was coded, you may need to make program code changes or changes to the original algorithm. This is why a great deal of time needs to be spent on the original algorithm.
Utilizing existing algorithms
Use any previous algorithms/programs to your advantage. If the current task is identical or similar in any way to any previous task, do not waste time reinventing the design/code when it already exists.
1. b analyze the problem  11. d pseudocode 
2. b output 
12. a Flowcharts 
3. a input  13 c process 
4. b output  14. a input/output 
5. b IPO charts 
15. d (rectangle) 
6. a input  16. c (parallelogram) 
7. b entering the input items into the computer  17. b (oval) 
8. c Processing  18. c deskcheck the algorithm 
9. c both what is to be calculated and how to calculate it  19. d all of the above 
10. c entering the input items, then processing the input items, and then displaying, printing, or storing the output items 
Solutions to Concept Lesson Exercises
Input 
Processing 
Output 
original number 
Processing items: none Algorithm:

squared value 
original number 
squared value 
4 6 
16 36 
2.
Input 
Processing 
Output 
state1 sales state2 sales commission rate 
Processing items: none Algorithm:

commission 
state1 sales 
state2 sales 
commission rate 
commission 
1000 3000 
2000 2500 
.05 .06 
150 330 
3.
Input 
Processing 
Output 
sales commission rate 
Processing items: none Algorithm: 
commission 
sales 
commission rate 
commission 
2000 5000 
.1 .06 
200 300 
Input 
Processing 
Output 
region1 sales region2 sales region3 sales region1 increase region2 increase region3 increase 
Processing items: none Algorithm:

region1 projected sales region2 projected sales region3 projected sales 
region1 sales 
region2 sales 
region3 sales 
region1 increase 
region2 increase 
region3 increase 
region1 projected saes 
region2 projected sales 
region3 projected sales 
10000 5000 
3000 2000 
6000 1000 
.1 .02 
.09 .03 
.1 .02 
11000 5100 
3270 2060 
6600 1020 
Input 
Processing 
Output 
original number 
Processing items: none Algorithm:
display an error message otherwise calculate the squared value by multiplying the original number by itself display the squared value 
squared value 
original number 
squared value 
10 3 
100 
beginning inventory 
amount sold 
amount returned 
ending inventory 
50 
10 
2 
58 
Changes made to the original algorithm are shaded in the IPO chart.
Input 
Processing 
Output 
beginning inventory amount sold amount returned 
Processing items: none Algorithm:

ending inventory 
Results of deskchecking the correct algorithm
beginning inventory 
amount sold 
amount returned 
ending inventory 
50 
10 
2 
42 
Input 
Processing 
Output 
hours worked rate of pay 
Processing items: none Algorithm:

gross pay 
Solutions to Application Lesson Exercises
Input 
Processing 
Output 
room length room width ceiling height single roll coverage 
Processing items: room perimeter wall area Algorithm: 
number of single rolls 
Input 
Processing 
Output 
beginning balance monthly deposits monthly withdrawals 
Processing items: none Algorithm:

ending balance 
beginning balance 
monthly deposits 
monthly withdrawals 
ending balance 
2000 500 
775 100 
1200 610 
1575 10 
Input 
Processing 
Output 
first number second number third number 
Processing items: none Algorithm:

average 
first number 
second number 
third number 
average 
25 10 
76 15 
33 20 
44.6666 15 
4.
Input 
Processing 
Output 
original price discount rate 
Processing items: none Algorithm:

sales discount new price 
original price 
discount rate 
sales discount 
new price 
100 50 
.25 .1 
25 5 
75 45 
5.
Input 
Processing 
Output 
number of envelopes number of pages charge per envelope charge per page 
Processing items: total envelope charge total page charge
Algorithm:

total due 
number of envelopes 
number of pages 
charge per envelope 
charge per page 
total envelope charge 
total page charge 
total due 
100 10 
100 15 
.10 .20 
.25 .30 
10 2 
25 4.50 
35 6.50 
6.
Input 
Processing 
Output 
first seminar attendees second seminar attendees seminar price 
Processing items: none Algorithm:

total attendees cost 
first seminar attendees 
second seminar attendees 
seminar price 
total attendees 
cost 
10 30 
10 10 
200 100 
20 40 
4000 4000 
7.
Input 
Processing 
Output 
hours worked hourly pay rate FWT rate FICA rate state rate 
Processing items: total taxes Algorithm:

gross pay FWT FICA state tax net pay 
hours worked 
hourly pay rate 
FWT rate 
FICA rate 
state rate 
total taxes 
gross pay 
FWT 
FICA 
state tax 
net pay 
20 30 
6 10 
.2 .2 
.08 .08 
.02 .04 
36 96 
120 300 
24 60 
9.60 24 
2.40 12 
84 204 
8.
Input 
Processing 
Output 
side1 side2 side3 side4 
Processing items: none Algorithm:

perimeter 
The deskcheck data may vary.
side1 
side2 
side3 
side4 
perimeter 
10 20 
6 10 
5 15 
8 20 
29 65 
9.
Input 
Processing 
Output 
diameter price per foot 
Processing items: none Algorithm: 
circumference total price 
The deskcheck data may vary.
diameter 
price per foot 
circumference 
total price 
35 7 
2 3 
109.90 21.98 
219.80 65.94 
10.
Input 
Processing 
Output 
length in feet width in feet price per square foot of tile 
Processing items: none Algorithm:

area total price 
The deskcheck data may vary.
length in feet 
width in feet 
price per square foot of tile 
area 
total price 
10 20 
6 10 
5 3 
60 200 
300 600 
11.
Input 
Processing 
Output 
length in feet width in feet height in feet 
Processing items: none Algorithm:

volume 
The deskcheck data may vary.
length in feet 
width in feet 
height in feet 
volume 
100 2 
30 3 
3 4 
9000 24 
12.
Input 
Processing 
Output 
old pay1 old pay2 old pay3 raise rate 
Processing items: none Algorithm:

new pay1 new pay2 new pay3 
old pay1 
old pay2 
old pay3 
raise rate 
new pay1 
new pay2 
new pay3 
7.55 8.00 
10.00 6.50 
10.30 7.25 
.02 .02 
7.70 8.16 
10.20 6.63 
10.51 7.40 
13.
Input 
Processing 
Output 
semester hours tuition per semester hour room and board fee 
Processing items: none Algorithm: 
total cost 
semester hours 
tuition per semester hour 
room and board fee 
total cost 
20 14 
100 100 
3000 3000 
5000 4400 
14.
Input 
Processing 
Output 
hours worked hourly pay rate 
Processing items: overtime pay Algorithm:
calculate the overtime pay as follows: first subtract 40 from the hours worked, then multiply the result by the hourly pay rate divided by 2 calculate the gross pay by multiplying the hours worked by the hourly pay rate, and then adding the overtime pay to the result otherwise calculate the gross pay by multiplying the hours worked by the hourly pay rate 
gross pay 
hours worked 
hourly pay rate 
overtime pay 
gross pay 
20 43 
6 10 
15 
120 445 
15. Changes to the original algorithm are shaded in the figure.
Input 
Processing 
Output 
number 
Processing items: none Algorithm:

cube of the number 
number 
cube of the number 
4 
64 
16. Changes to the original algorithm are shaded in the figure.
Input 
Processing 
Output 
original price discount rate 
Processing items: none Algorithm:

discount sale price 
original price 
discount rate 
discount 
sale price 
100 
.25 
25 
75 