Syllabus

Home

Class Resources

News

In-Class Problem: Compute Mileage of a Vehicle


Download the form.
  1. Using the from shown above write a program that solves the following problem: A motorist calculates his milage at each tank fillup by entering the odometer reading from the previous fillup, the current odometer reading and the amount of gas needed to fill the tank in gallons. The resulting mileage is displayed in the bottom list box.
  2. This form has text boxes for entering three values: Previous odometer reading, current odometer reading and gallons of gas this fillup. The bottom list box is used to display the result.
  3. Your program should contain all of the following:
    1. Comments that describe the program and identify the author
    2. Declarations of all variables
    3. VB statements that import values from the text boxes.
    4. Calculations that compute the mileage of the vehicle.
    5. Statements that output the result to the list box.
  4. Test the program with several sets of input and verify that the calculations are correct.
  5. Save your program to floppy disk (or other storage devise).