Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA JAVA JAVA JAVA JAVA JAVA JAVA Hello, I need the code edited so my output ed

ID: 3713141 • Letter: J

Question

JAVA JAVA JAVA JAVA JAVA JAVA JAVA

Hello,

I need the code edited so my output edit to correctly match the expected output:

NOTE: Notice the small differences in my output and expected output.

Input:

2016
Honda Accord
27.5
15.5
2015
Chevrolet Tahoe
19.2
26.1

My output:


Enter auto model year:
Enter auto make and model:
Enter auto mileage (in miles per gallon):
Enter auto tank capacity (in gallons):

Enter auto model year:
Enter auto make and model:
Enter auto mileage (in miles per gallon):
Enter auto tank capacity (in gallons):

On average, 2016 cars have approximately 24000 miles on the odometer
2016 Honda Accord has a 15.5 gallon tank and gets 27.5 miles per gallon.

On average, 2015 cars have approximately 24000 miles on the odometer
2015 Chevrolet Tahoe has a 26.1 gallon tank and gets 19.2 miles per gallon.
Range is 501 miles

2015 Chevrolet Tahoe has a longer range


Expected output:


Enter auto model year:
Enter auto make and model:
Enter auto mileage (in miles per gallon):
Enter auto tank capacity (in gallons):

Enter auto model year:
Enter auto make and model:
Enter auto mileage (in miles per gallon):
Enter auto tank capacity (in gallons):

On average, 2016 cars have approximately 24000 miles on the odometer
2016 Honda Accord has a 15.5 gallon tank and gets 27.5 miles per gallon
Range is 426 miles

On average, 2015 cars have approximately 36000 miles on the odometer
2015 Chevrolet Tahoe has a 26.1 gallon tank and gets 19.2 miles per gallon
Range is 501 miles

2015 Chevrolet Tahoe has a longer range

Explanation / Answer

Auto.java

public class Auto {

public int modelYear;
public String modelMake;
public double mileage;
public double tankCapacity;
public final int CURRENT_YEAR = 2018;
public final int AVG_MILES = 12000;
public Auto(int modelYear, String modelMake, double mileage, double tankCapacity) {
super();
this.modelYear = modelYear;
this.modelMake = modelMake;
this.mileage = mileage;
this.tankCapacity = tankCapacity;
}
public Auto() {
super();
}
public void setModelYear(int modelYear) {
this.modelYear = modelYear;
}
public void setModelMake(String modelMake) {
this.modelMake = modelMake;
}
public void setMileage(double mileage) {
this.mileage = mileage;
}
public void setTankCapacity(double tankCapacity) {
this.tankCapacity = tankCapacity;
}
public int computeAvgMiles() {
int carYear = CURRENT_YEAR - modelYear;
return carYear * AVG_MILES;
}
public double computeRange() {
return (mileage / tankCapacity);
}
public void displayAutoData() {
System.out.println("Enter auto model year:");
System.out.println("Enter auto make and model:");
System.out.println("Enter auto mileage (in miles per gallon):");
System.out.println("Enter auto tank capacity (in gallons):");
}
}

_________________

Output:

Enter auto model year:
2016
Enter auto make and model:
Honda Accord
Enter auto mileage (in miles per gallon):
27.5
Enter auto tank capacity (in gallons):
15.5

Enter auto model year:
Enter auto make and model:
Enter auto mileage (in miles per gallon):
Enter auto tank capacity (in gallons):

On average, 2016 cars have approximately 24000 miles on the odometer
2016 Honda Accord has a 15.5 gallon tank and gets 27.5 miles per gallon
Range is 426 miles

Enter auto model year:
2015
Enter auto make and model:
Chervolet Tahoe
Enter auto mileage (in miles per gallon):
19.2
Enter auto tank capacity (in gallons):
26.1
Enter auto model year:
Enter auto make and model:
Enter auto mileage (in miles per gallon):
Enter auto tank capacity (in gallons):

On average, 2015 cars have approximately 36000 miles on the odometer
2015 Chervolet Tahoe has a 26.1 gallon tank and gets 19.2 miles per gallon
Range is 501 miles

2015 Chervolet Tahoe has a longer range

_______________Thank You