Answer:

The new model car is below.

Completed Method

Notice how the oldest odometer reading is forgotten as the newest one is recorded. After the change, (endMiles - startMiles) will be the number of miles traveled between the previous fillup and this one.

class Car
{
  // data
  private int startMiles;   // Stating odometer reading
  private int endMiles;     // Ending odometer reading
  private double gallons;   // Gallons of gas used between the readings

  // constructor
  Car(  int first, int last, double gals  )
  {
    startMiles = first ;
    endMiles   = last ;
    gallons    = gals ;
  }

  // methods
  double calculateMPG()
  {
    return (endMiles - startMiles)/gallons ;
  }

  void fillUp(int newOdo, double fillUpGals )
  {

    startMiles = endMiles;

    endMiles   = newOdo;

    gallons    = fillUpGals;

  }
}

Now let us consider what a fillUp method for an entire Fleet will look like.

QUESTION 13:

(Design decision: ) What four parameters will the Fleet's fillUp method have?