Question: WRITE THE CODE IN JAVA !!! The following class files are provided. You have files for Locomotive , FuelType , Automobile , and SUV .

WRITE THE CODE IN JAVA !!!

The following class files are provided.

You have files for LocomotiveWRITE THE CODE IN JAVA !!! The following class files are provided., FuelTypeYou have files for Locomotive, FuelType, Automobile, and SUV. Add Car that, Automobileextends Automobile and has zeroToSixty as instance variable. Default value of 3, and SUVseconds. Add Truck that extends Automobile and has numOfWheels as instance variable..

Add Car that extends Automobile and has zeroToSixty as instance variable. Default value of 3 seconds.

Add Truck that extends Automobile and has numOfWheels as instance variable. Default value of 16.

Add a class Train that extends Locomotive Has FuelType as Solar, as default - you have to update the FuelType Has numOfCars with 4 as its default Has numOfEngines with 1 as its default Create a class AirPlanes that extends Locomotive Has routes - DOMESTIC or INTERNATIONAL - Make it ENUM type.

Please note: each class will have necessary constructors, setters() and getters() as required, and the toString() method.

Upload all java source files as 1 zip file.

THE FOLLOWING ARE THE FILES FOR LocomotiveDefault value of 16. Add a class Train that extends Locomotive Has, FuelTypeFuelType as Solar, as default - you have to update the FuelType, AutomobileHas numOfCars with 4 as its default Has numOfEngines with 1 as, and SUVits default Create a class AirPlanes that extends Locomotive Has routes -. DESCRIBED IN THE BEGING

files for LocomotiveDOMESTIC or INTERNATIONAL - Make it ENUM type. Please note: each class ::

public abstract class Locomotive

{

private FuelType ft;

public void setFuelType(FuelType f) { ft = f; }

public FuelType getFuelType() { return ft; }

}

files for FuelType::

public enum FuelType

{

DIESEL, GAS, HYBRID, ELECTRIC

}

files forAutomobile::

public class Automobile extends Locomotive

{

private String mode;

private String manufacturer;

private String owner;

private double price;

public Automobile() { this("LAND"); }

public Automobile(String m) { this.setMode(m); }

public Automobile(String ma, String o, double p) {

this.setManufacturer(ma); this.setOwner(o); this.setPrice(p);}

public void setMode(String m) { mode = m; }

public String getMode() { return mode; }

public void setManufacturer(String m) { manufacturer = m; }

public String getManufacturer() { return manufacturer; }

public void setOwner(String o) { owner = o; }

public String getOwner() { return owner; }

public void setPrice(double p) { price = p; }

public double getPrice() { return price; }

public String toString()

{ String tmp = "Uses Fuel Type: " + this.getFuelType() + " Mode is: "

+ mode;

tmp += " Manufacturer is: " + manufacturer + " Owner is: " +

owner;

tmp += " Price is: " + price;

return tmp; }

}

files for SUV::

public class SUV extends Automobile

{

private static int numOfSUVs = 0;

public SUV() { super("NA","NA", 0.0); numOfSUVs++; }

public SUV(String ma) { super(ma, "NA", 0.0); numOfSUVs++; }

public SUV(String ma, String o) { super(ma, o, 0.0); numOfSUVs++;}

public SUV(String ma, String o, double p) { super(ma, o, p);

numOfSUVs++;}

public static int getNumOfSUVs() { return numOfSUVs; }

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!