Answered step by step
Verified Expert Solution
Question
1 Approved Answer
create a c + + program Create a class Electric _ Car It has an attribute Battery _ Level ( type int ) for a
create a c program Create a class ElectricCar
It has an attribute BatteryLevel type int for a value from
to
Make Recharge function that adds a number to the
BatteryLevel.
Make ShowBat function that shows current BatteryLevel on
screen.
QB Create a class PetrolCar
It has an attribute FuelLevel type double for a value from
to Liter
Make FillUp function that adds a number to the
FuelLevel.
Make ShowFuel function that shows current FuelLevel on
screen.
PetrolCar
double FuelLevel
FillUp
ShowFuel
HybridCar
char RunningMode
SwitchModechar mode
Run
ElectricCar
int BatteryLevel
void Recharge
ShowBat
Object Oriented Programming Lab
QC Create a class HybridCar
It has an attribute RunningMode type chr
o If RunningMode is b then car is on Battery mode.
o If RunningMode is f then car is on Fuel mode.
Make SwitchModechar mode function that changes the
RunninMode to b or f based on function arguments.
Make Run function that
o subtracts from BatteryLevel if car is on Battery mode
o subtracts from FuelLevel if car is on Fuel mode.
QD Make an Object of HybridCar in main function and show the
simulation results on screen.
Generate random numbers from to
o If number equals to call FillUp
o If number equals to call Recharge
o If number equals to call SwitchModeb
o If number equals to call SwitchModef
o If number equals to call Run
o If number equals to call Run
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