1. The first car in the fleet has odometer readings of 1000, 1234, and gallons of 10
  2. The second car in the fleet has odometer readings of 777, 999, and gallons of 20

Answer:

class FleetTester
{
  public static void main ( String[] args)
  {
    Fleet myCars = new Fleet( 1000, 1234, 10, 777, 999, 20  );
  }
}

Constructor for Fleet

In this program, the cars that make up a fleet are constructed when the fleet is constructed. Here is the program with some additional work:

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

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

  // method

}

class Car
{
  . . . .

  Car(  int first, int last, double gals  )
  {
    . . . .
  }
}

class FleetTester
{
  public static void main ( String[] args)
  {
    Fleet myCars = new Fleet( 1000, 1234, 10, 777, 999, 20 );
  }

}

QUESTION 6:

Fill in the blanks in the constructor for Fleet. It should construct each of the two cars.