Question
Java Program: Create a class named Car that contains data fields for the manufacturer, model, and manufacture year, e.g. Ford, Escape, 2015. Include get and
Java Program:
Create a class named Car that contains data fields for the manufacturer, model, and manufacture year, e.g. Ford, Escape, 2015. Include get and set methods for these fields. The class also includes a display() method that displays all the car data. Next, create a subclass named RaceCar, which contains an additional field that holds the number of races in which the car has competed and additional methods to get and set the new field. Override the parent class display() method to include RaceCar information. Next create a subclass named PrivateCar which contains an additional field that holds the owners name and additional methods to get and set the new field. Override the parent class display() method to include PrivateCar information. Write an application that demonstrates using objects of each class. Save the files as Car.java, RaceCar.java, PrivateCar.java, and DemoCar.java. At the beginning of the program add comments including program description.
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