Answered step by step
Verified Expert Solution
Link Copied!

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***

  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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

Students also viewed these Databases questions