Question: Task 1 ) Define a FuelType enum with values for different fuel types such as Gasoline, Diesel, Electric. b ) mplement the classes below with
Task
Define a FuelType enum with values for different fuel types such as "Gasoline", "Diesel", "Electric".
b mplement the classes below with the following instructions:
equals compares two objects based on the field values: If they match, it returns true; if not, false
toString prints out the fields of the class.
Make sure methods usereturn a deep copy of the Engine object not a reference copCar
make: String model: String year: int
engine : Engine
Carma:String, mo:String, y:int, eng:Engine
setMakema:String : void setModelmo:String : void
setYeary:int: void setEngineeng:Engine: void
getMake: String getModel: String getYear : int getEngine: Engine toString: String
equalscar: Car: boolean
Engine
EngineType: String
Horsepower: int fuelType: FuelType
Engineet:String, hp:int, ft:FuelTypeEngineengine: EnginesetEngineTypeet:String : void setHorse Powerhp:int : void setFuelTypeft:FuelType : void getEngineType: String getHorsePower : int getFuelType: FuelType
toString: String
equalseng: Engine: boolean
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
