Question: JAVA Goal: Learn how to how to extend classes. Assignment: Imagine you have a superclass named Vehicle that: has two private data fields: maxSpeed (

JAVA
Goal: Learn how to how to extend classes.
Assignment: Imagine you have a superclass named Vehicle that:
has two private data fields: maxSpeed (of type double) and color (of type String);
provides both a default constructor Vehicle() and a parameterized constructor Vehicle(double maxSpeed, String color);
provides public getters and setters getMaxSpeed, getColor, setMaxSpeed, setColor.
Your task is to create a public subclass named Car that extends the Vehicle class. This subclass should introduce an additional private attribute named make (of type String) to represent the car's make (e.g., Toyota, Ford).
In the Car subclass:
Include a constructor Car(String make, int speed, String color).
Include a public getter and setter for the make attribute.
// write your code below

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!