Question: Vehicle.Java : /* * This abstract superclass Vehicle contains an abstract method * getmpg(), to be implemented by its subclasses. */ abstract public class Vehicle

Vehicle.Java :
/*
* This abstract superclass Vehicle contains an abstract method
* getmpg(), to be implemented by its subclasses.
*/
abstract public class Vehicle {
// Private member variable
private int year;
// Constructor
public Vehicle (int vyear) {
this.year = vyear;
}
@Override
public String toString() {
return "Shape of color=\"" + color + "\"";
}
// All Vehicle subclasses must implement a method called getMpg() a
calculed
// value based on year
abstract public double getMpg();
}
VehicleTest-1.java :
import java.util.*;
public class VehicleTest
{
public static void main( String[] args )
{
Vehicle[] vehicleObjects = new Vehicle[ 4 ];
//populate array with 2 luxury and 2 standard vehicles
for ( Vehicle currentVehicle : vehicleObjects )
{
//display vehicle and mpg
}
}
}
[10 points] Submit subclass StandardVehicle java [10 points] Submit sublcass LuxuryVehicle java each are subclasses of super abstract class Vehide java toString0 will display information differently depending on if its a StandardVehicle object or a LuxuryVehicle object-see previous labs on what that information is add set) and get() methods getMpg) is calculated differently between a standard vehicle and luxury vehicle as such Standard Vehicle year 2000 mpg is 40mpg each year prior to 2000 mpg -1, each year after 2000 mpg +1 Luxury Vehicle- year 2000 mpg is 30mpg each year prior to 2000 mpg-2, each year ater 2000 mpg +2 Example: Standard vehicle of year 2002 has an mpg of 42 (2000+ 1+ 1) Luxury vehicle of year 2002 has an mpg of 34 (30+ 2+2) 4. (5 points] Complete and submit our Test diver program: Vehicle Test-1 java (notice renamed with 1 because I aiready have a Vehicle Test java from previous assignment, remember to download and rename
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
