Answer:

Yes, but it seems more natural to calculate the first MPG first and the second MPG second.

The Data

Here is the list of data. The program will prompt for and read in each number.

  1. The odometer reading at the start.
  2. The second odometer reading (after the first tank of gas is nearly empty).
  3. The gallons of gas needed to fill the tank.
  4. The third odometer reading (after the second tank is nearly empty).
  5. The gallons of gas used to fill the tank again.

The names you chose for the variables in a program can make the programming easy, or can make it hard and error-prone. The name of a variable should indicate what it is.

For example, the first odometer reading should be called something like FIRSTMILES, since it is the first reading of miles.

QUESTION 5:

Think of a descriptive name for the second odometer reading.