Question
public class Vehicle { private String make; private String model; private int year; private Color color; enum Color {SILVER, RED, BLUE, BLACK;} public Vehicle() {
public class Vehicle {
private String make;
private String model;
private int year;
private Color color;
enum Color {SILVER, RED, BLUE, BLACK;}
public Vehicle()
{
make = "";
model = "";
year = 0;
color = Color.SILVER;
}
public Vehicle(String make, String model, int year, Color color)
{
this.make = make;
this.model = model;
this.year = year;
this.color = color;
}
public String getMake()
{
return make;
}
public void setMake(String make)
{
this.make = make;
}
public String getModel()
{
return model;
}
public void setModel(String model)
{
this.model = model;
}
public int getYear() {
return year;
}
public void setYear(int year) {
this.year = year;
}
public Color getColor() {
return color;
}
public void setColor(Color color) {
this.color = color;
}
@Override
public String toString() {
return "Vehicle Make = " + make + " Model = " + model + " Year = " + year + " Color = " + color;
}
}
public class VehicleTest {
public static void main(String[] args) {
Vehicle car = new Vehicle("Ford", "F150", 2018, Vehicle.Color.BLACK);
Vehicle truck = new Vehicle();
System.out.println(car);
System.out.println(truck);
}
}
3. [10 points] Submit LuxuryVehicle java subclass of Vehicle.java (re-submit Vehiclejava, as I will need it to instantiate your LuxuryVehicle object) . LuxuryVehicle has the additional attributes of: Number of Years Warranty (3 to 10 years), Number of Years RoadSide assistance (3 to 10 years), Wifi option (yeso), Self-driving option (yeso). . Override the toString) method of LuxuryVehicle to display all additional attributes - be sure to re-use Vehicle toString0 method in LuxuryVehicle toString0 by using the super keyword. create additional constructors() that account for new attributes, be sure to re-use super class constructurs) when you can. . create additional set() and get() methods for new attributes. 4. (10 points] submit LuxuryVehicleTest.java the instantiates 2 LuxuryVehicle objects and tests their constructors), set) and get) methods, and their toString) methodsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started