The complete program is given below.
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() );
}
}