Pseudo Code for car problem

 

Added to the basic program is a calculation for the average miles per gallon for all cars and the car number must be greater than 60 – write note to user if not

 

Open file cars

If file doesn’t exist, write user a note and exit program

Write headings for report

Set total cars to zero

Set total mpg to zero

Read a record – if EOF, exit loop

If car number<=60

Write line stating so

Continue loop(to skip the rest of this)

Calculate mpg

Add individual mpg to totalMpg

Add 1 to total cars

Write individual car line

Calculate the Overall Average

Output the Overall Average

Close Files