A good answer might be:

Easy. The filled in program is below.


Picture of the Two-objects Program

In this program, two defferent Car objects are constructed, each with different data, and the miles per gallon calculation is performed on each.

import java.io.* ;

class Car
{
  . . . .
}

class MilesPerGallon
{
  public static void main( String[] args ) 
  {
    Car car1 = new Car( 32456, 32810, 10.6 );
    System.out.println( "Miles per gallon of car 1 is " 
        + car1.calculateMPG() );

    Car car2 = new Car( 100000, 100300, 10.6 );
    System.out.println( "Miles per gallon of car 2 is " 
        +  car2.calculateMPG() );

  }
}

The picture shows the situation just after the second object has been constructed: Notice that there is one class definition, two objects, and one static main().

QUESTION 14:

There are two objects, but each has the same names for its instance variables! Is this a mistake?