Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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);

}

}

image text in transcribed

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) methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

How does the concept of modularization apply to this example?

Answered: 1 week ago