Question: ***Please answer the below java question*** Create a new class called hybrid. Hybrid vehicles still have a gas tank, engine, etc., but also includes a
***Please answer the below java question***
- Create a new class called hybrid. Hybrid vehicles still have a gas tank, engine, etc., but also includes a battery bank - which at a high level, can be viewed of as an electric gas tank (i.e. has similar properties to a gas tank max capacity, current charge, etc.). Think through what additional properties you might need to add for this class. Then look through the member methods of the car class which ones will likely have to be overloaded or perhaps overridden?
- Add at least 2 appropriate data properties to this class
- Create the no-arg constructor for this class (explicitly call the super class)
- Create 2 gets for the added data properties
- Create 2 sets for the added data properties
- Look at your utility method CalcDistance obviously the hybrid has a longer range because of the battery bank, AND there is a limited recharge capability to the batteries when the engine is running (gas side). So, lets say the distance calculation is below (completely fictional):
Total Miles = [electrical portion] + [gas portion] + [recharge portion]
Total Miles = current charge * 100 + ((mpg * currentGas)+ (mpg*currentGas*0.133))
* current charge for this exercise is simply a % of total charge (i.e. 0
So should the method be overloaded? Or overridden? Why? (Explain in 2 or 3 sentences) Then write/rewrite this member method for the hybrid class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
