Answered step by step
Verified Expert Solution
Question
1 Approved Answer
***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***
- 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?
- 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started