Answered step by step
Verified Expert Solution
Question
1 Approved Answer
java Make an abstract superclass called Vehicle that have the following private data fields: color: a string that holds the color of the vehicle. dateMade:
java
Make an abstract superclass called Vehicle that have the following private data fields: color: a string that holds the color of the vehicle. dateMade: the date the vehicle was manufactured. Givea ppropriate constructors and setter/getter methods for this class. Have an abstract void method named steer(). Define an interface named Drivable that have an abstract method named howToDrive() with return value type String. Make a concrete subclass named Car that extends the Vehicle class and implements the Drivable and Comparable interfaces. The class should have a String data field: model and an integer data field: speed. Provide appropriate constructors and setter/getter methods for this class. Override the equals method in the Object class. Two Car objects are equal if their models are the same. Implement the steer() method to display "Turn steering wheel." Implement the howToDrive() method that returns a string "Step on gas pedal." Implement the compareTo method to compare two cars on the basis of speed. Make a test program to test your classes and interface
Step 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