![]() |
Example 10A youth club runs a disco every Friday, Saturday and Sunday. They sell different flavors of chips at 65c per bag. The youth club requires a program which adds up the total number of bags of chips of a particular flavor sold on the three nights and calculates the total money raised. 1. Design a Solution Our first attempt is: 1. get information from user
Step 1 becomes: 1.1 ask user to enter flavor of chips
2.1 calculate total bags sold
3.1 print out flavor
The complete design is shown below:
|
1.1 ask user to enter flavor of chips
2.1 calculate total bags sold
3.1 print out flavor
|
3. Test the Program
4. Evaluate the Solution
[From now on we're not always going to ask you to do steps 3 and 4 ie to test the program and evaluate it. That's not because it isn't important, but because we think you should really do it as a matter of course and without needing to be asked every time. If it's necessary to look at this aspect for any particular examples then we will say so. See your teacher if there's any doubt.]
|
© 1998 John Brewer |