Question: You are given the following skeleton Java class. The questions marks are the missing codes that you need to figure out. This class can generate
You are given the following skeleton Java class. The questions marks are the missing codes that you need to figure out. This class can generate objects of automobiles with make, model, tanksize, and range. The range indicates the total mileage that this car can run. Your task is to print out the information of this car and its mileage per gallon with 2 decimal points using formatted output.
public class Automobile {
private String make;
private String model;
private double tanksize;
private double range;
/* constructor */
public Automobile (???????) {
/* a method to print the auto information and mileage per gallon with 2 decimal points */
public void printInfo(){
System.out.println("Make:" + make);
System.out.println("====================");
Write a tester class using the following skeleton codes.
public class TesterAuboMobile
{
public static void main(String args[])
/* input make, model, tanksize, and range */
? make1 = ???
? model1 = ???
? tanksize1 = ???
? range1 = ????
Automobile car1 = new (make1, model1, tanksize1, range1);
}
Using the example of Totyoa, Camery, tanksize of 17, and range of 500.
Your output should be similar to:
====================
Make: Toyota
Model: Camry
MPG: 29.41
====================
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
