Question: 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) double
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) double milesPerGallon iii) string color b) Public Class Methods i) Auto(string name, double mpg, string color) ii) string getBrandName() iii) void setBrandName(string name) iv) double getMilesPerGallon() v) void setMilesPerGallon(double mpg) vi) string getColor() vii) void setColor(string color) viii) abstract string printStats() 2) C reate 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, doublempg, 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) C reate 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, doublempg, 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
- Java file is named correctly.
- Name, date and assignment information is included at the top of your Java code file as a comment.
- Java code is properly indented and readable.
- Code comments are present within each major section of code.
- Screenshot of the code compiling successfully in the IDE with the timestamp showing.
- Screenshot of the code running showing the correct output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
