Question: CSCI - 2 4 6 7 Lab 7 Inheritance Assignment Download the Lab 0 7 . zip starter file. Use 7 zip to unzip the

CSCI-2467 Lab 7 Inheritance Assignment
Download the Lab07.zip starter file. Use 7zip to unzip the file using Extract Here. Open the project folder in IntelliJ.
Examine the Main and Car classes. You are going to add two classes derived from Car: GasolineCar and ElectricCar.
Create GasolineCar class
1) Select package edu.cscc and create a new Java class called GasolineCar 2) Make the class inherit from the Car class
3) Add two private field (in the following order):
An int field named cylinders which denotes the numbers of cylinders in the car's gasoline engine
A double field named tankCapacity which lists the car's gas tank capacity in gallons
4) Generate a constructor and all getters and setters
5) Add a describe method that overrides the method in the base class. It should call the base class describe method
and then print the car's number of cylinders and gas tank capacity (see Example Output below).
In the Main class uncomment the gasoline cars in the carFleet array (see TODO comment) and run the program to test your new code. Verify the output and fix any bugs in your GasolineCar class that you detect.
Create ElectricCar class
1) Select package edu.cscc and create a new Java class called ElectricCar
2) Make the class inherit from the Car class
3) Add a private int field batterySize which lists the car's battery capacity in kilowatt hours
4) Generate a constructor and all getters and setters
5) Add a describe method that overrides the method in the base class. It should call the base class describe method
and then print the car's battery capacity (see Example Output below).
In the Main class uncomment the electric cars in the carFleet array (see TODO comment) and run the program to test your new code. Verify the output and fix any bugs in your ElectricCar class that you detect.
Finally, find the initial TODO comment in the Main class replace the comment with a comment including your name, the date, and the purpose of the program.
Turning in Your Assignment
Once youve completed and thoroughly tested your assignment, you are ready to submit it. Zip your IntelliJ project folder for this lab and upload the zip file to Blackboard for grading.
Students who submit projects that do not compile will receive a zero for the lab.
Example Output
*** Our Car Fleet ***--- Vehicle #1--- Make: Toyota
Model: Rav4
Year: 2015
Cylinders: 4
Fuel Tank Capacity: 15.5--- Vehicle #2---
Make: Ford
Model: F-150
Year: 2017
Cylinders: 6
Fuel Tank Capacity: 20.1--- Vehicle #3---
Make: Honda
Model: Civic
Year: 2012
Cylinders: 4
Fuel Tank Capacity: 12.4--- Vehicle #4---
Make: Tesla
Model: Model 3
Year: 2020
Battery size: 55
--- Vehicle #5---
Make: Tesla
Model: Model Y
Year: 2021
Battery size: 58
--- Vehicle #6---
Make: Aston Martin Model: Rapide E
Year: 2020
Battery size: 65
Process finished with exit code 0

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!