Question: ***Please answer the below multi part java question*** Create a new class called hybrid (yes, just like the electric/gas hybrid vehicle) which is based on

***Please answer the below multi part java question***

  1. Create a new class called hybrid (yes, just like the electric/gas hybrid vehicle) which is based on (or will inherit from) the car class that you built in homework #1. 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?

  1. Add at least 2 appropriate data properties to this class
  2. Create the no-arg constructor for this class (explicitly call the super class)
  3. Create 2 gets for the added data properties
  4. Create 2 sets for the added data properties
  5. 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

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