A good answer might be:

The complete program is given below.


Finished Program

Here is the complete program. Of course, the program still cannot be run because the class Car has not yet been defined.

import java.io.* ;
import Car ;

class MilesPerGallon
{
  public static void main( String[] args ) 
      throws IOException
  {
    BufferedReader userIn = 
        new BufferedReader(
        new InputStreamReader( System.in ) );

    String line;
    int    startMiles, endMiles;
    double gallons;

    System.out.println("Enter first reading:" ); 
    line = userIn.readLine();
    startMiles = Integer.parseInt( line );

    System.out.println("Enter second reading:" ); 
    line = userIn.readLine();
    endMiles = Integer.parseInt( line );

    System.out.println("Enter gallons:" ); 
    line = userIn.readLine();
    gallons = Integer.parseInt( line );

    Car car = new Car( 
        startMiles, endMiles, gallons  );

    System.out.println( "Miles per gallon is " 
        + car.calculateMPG() );
  }
}

QUESTION 5:

We still need a definition for class Car. Can a programmer write a definition for the class Car?