< previous page page_81 next page >

Page 81
(text box continued from previous page)
program. Studies show that people who do all of their debugging away from the computer actually get their programs to work in less time and in the end produce better programs than those who continue to work on the machinemore proof that there is still no mechanical substitute for human thought.*
*Basili, V. R., Selby, R. W., Comparing the Effectiveness of Software Testing Strategies, IEEE Trans. on Software Engineering, Vol. SE-13, No. 12, pp. 12781296, Dec. 1987.

Finishing Up
On larger computer systems, once you finish working on your program, you have to log off by typing a command. This frees up the terminal so that someone else can use it. It also prevents someone from walking up to the terminal after you leave and tampering with your files.
On a personal computer, when you're done working, you save your files, then remove any disks that you've inserted. Turning off the power wipes out what's in the computer's memory, but your files are stored safely on the disks. The next time you use the computer, you simply reinsert the disks and the computer is able to recall the files from them. (If the PC is in a lab where it gets frequent use by many people, you'll probably be asked to leave the computer on in order to save wear and tear on the machine.)
Be sure to read the manual for your particular system and editor before you enter your first program. Don't panic if you have trouble at firstalmost everyone does. It becomes much easier with practice.
Problem-solving case study Mileage
0081-01.gif
Problem: Write a program to calculate the miles per gallon a car gets on a trip, given the amounts in gallons of the fillups and the starting and ending mileage. The starting mileage was 67308.0; the ending mileage, 68750.5. During the trip, the car was filled up four times. The four amounts were 11.7, 14.3, 12.2, and 8.5 gallons. Assume that the tank was full initially and that the last fillup was at the end of the trip.
Output: The quantities on which the calculations are based and the computed miles per gallon, all appropriately labeled.

 
< previous page page_81 next page >