Question: Question 1 ( See Java Project Attached, Complete the code ) You are tasked with building a simple system for a car showroom that deals

Question 1(See Java Project Attached, Complete the code)
You are tasked with building a simple system for a car showroom that deals with different
brands of cars. The showroom manages cars of different brands, including Ford and Tesla.
Each car brand has unique features and specifications. The showroom needs to keep track of
its inventory and allow potential buyers to view car details.
Requirements:
1. Create a class Car:
a. It should be an abstract class that represents a general car.
b. It should have the following private attributes: modelName (String), price
(double), and year (int).
c. It should have a constructor to initialize these attributes.
d. Provide public getter mmethods for these attributes.
e. Provide an abstract method showCarDetails() to display the car details.
2. Create a class Ford that:
a. Inherits from the Car class.
CSC 220- Dr. Sanika Doolani
b. Implements the showCarDetails() method to display Ford-specific details.
c. Has additional attributes: isEcoBoost (boolean) and warrantyYears (int).
d. Contains a constructor to initialize all attributes (including those inherited from
Car).
3. Create a class Tesla that:
a. Inherits from the Car class.
b. Implements the showCarDetails() method to display Tesla-specific details.
c. Has additional attributes: autopilotEnabled (boolean) and batteryLife
(int).
d. Contains a constructor to initialize all attributes (including those inherited from
Car).
4. Create an interface IShowroom:
a. The interface should have methods addCar(Car car) and
showInventory().
5. Create a class CarShowroom that:
a. Implements the IShowroom interface.
b. Maintains the count of cars in the showroom inventory using an int
inventory
c. Implements the showInventory() method to display the number of all cars in
the inventory by calling showCarDetails().
6. Create a App class to demonstrate the following:
a. Create objects for Ford and Tesla cars.
b. Add these cars to the showroom.
c. Display the inventory.
7. Last Minute Requirement: The Car Showroom should only have a maximum inventory
of 4 cars
a. In the interface, add MAX_NUM_OF_CARS of value 4
b. When adding a car to the method addCar(Car car) check whether the
inventory is less than MAX_NUM_OF_CARS. If not, display an output of Cannot
add this car

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 Programming Questions!