Question: Create a Java program that will contain the following architecture: 1) Create an abstract class called Auto in Auto.java that contains the following data and
Create a Java program that will contain the following architecture: 1) Create an abstract class called Auto in Auto.java that contains the following data and methods: a) Private Class Data i) string brandName ii) float milesPerGallon iii) string color b) Public Class Methods i) Auto(string name, float mpg, string color) ii) string getBrandName() iii) void setBrandName(string name) iv) float getMilesPerGallon() v) void setMilesPerGallon(float mpg) vi) string getColor() vii) void setColor(string color) viii) abstract string printStats() 2) Create a specialization class called Truck in Truck.java that extends the Auto class and contains the following data and methods: a) Private Class Data i) int horsePower b) Public Class Methods i) Truck(string name, float mpg, string color, int horsepower) ii) string printStats() will return the information about the truck in string form. For example, Truck Brand: GMC MPG: 5.0 Color: Silver HP: 600 3) Create a specialization class called Car in Car.java that extends the Auto class and contains the following data and methods: a) Private Class Data ii) integer numberOfDoors b) Public Class Methods i) Car(string name, float mpg, string color, int numDoors) ii) string printStats() will return the information about the car in string form. For example, Car Brand: Porsche MPG: 10.0 Color: Red Number of Doors: 4 Then create a test class called AutoTest in AutoTest.java that contains the following code in main(): ArrayList autoList = new ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
