A good answer might be:

You could calculate the MPG of each car in the fleet and then average those numbers.

calculateMPG() Method

For us, there are two cars in the fleet, so the average MPG of the fleet will be the sum of the MPGs for each car, that sum divided by two. Here is the class, with more details:

class Fleet
{
  // data
  Car town;
  Car suv;

  // constructor
  Fleet( int start1, int end1, double gal1, 
         int start2, int end2, double gal2 )
  {
    town = new Car( start1, end1, gal1) ;
    suv  = new Car( start2, end2, gal2) ;
  }

  // method
  double calculateMPG()
  {
    double sumMPG; 

    sumMPG = town.______________ + suv.____________ ;

    return sumMPG/2.0;
  }
}

class Car
{
  . . . .
  double calculateMPG() . . . .

}

class FleetTester
{
  public static void main ( String[] args)
  {
    Fleet myCars = new Fleet( 1000, 1234, 10, 777, 999, 20 );
    System.out.println("Fleet average MPG= " + myCars.calculateMPG() );
  }
}

It is perfectly OK for both Car and Fleet to have a calculateMPG() method. Notice that when main() uses calculateMPG() it is clear which one to use: the one that is part of the object referenced by myCars (a Fleet object).

QUESTION 9:

Fill in the blanks for the calculateMPG() method of Fleet.