Are actual car objects part of the definition of Fleet?

A good answer might be:

No---the definition for Fleet says that a Fleet object has two variables that refer to Car objects.

Instance Variables for Fleet

The long-lasting state of a Fleet object will be held in its two instance variables---which refer to Car objects. Pretend that Fleet has been defined. The documentation might look like this:


Fleet

A class that holds two Car objects.

Constructors

  • Fleet( int Car1StartOdo, int Car1EndingOdo, double Car1Gallons,
              int Car2StartOdo, int Car2EndingOdo, double Car2Gallons )
    • Creates a new instance of a Fleet object with the starting and ending odometer readings and the number of gallons of gas consumed for each car.
Methods
  • double calculateMPG()
    • calculates and returns the average miles per gallon for the fleet.

The constructor for a fleet will build the two cars it consists of. Since each car needs three values, the constructor for the fleet will need a total of six values. (There are other more elegant ways to do this, but let us do it this way for now.) Here is a short main() that constructs a fleet:


class FleetTester
{
  public static void main ( String[] args)
  {
    Fleet myCars = new Fleet( ____, ____, ____, ____, ____, ____  );
  }

}

QUESTION 5:

Fill in the blanks so that the Fleet object looks like this:

  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

Click Here after you have answered the question