Question: Objectives In C++ Review how to create classes Learn to overload operators to work with a custom class Learn how to build a class using
Objectives
In C++
Review how to create classes
Learn to overload operators to work with a custom class
Learn how to build a class using aggregation
Instructions:
For this assignment you are tasked with simulating an Uber driver. To complete this task we will simplify a car to something that has a fuel gauge and a speedometer. We will neglect all of the mechanical details that allow a real car to work the way they work. The description below is the minimum set of requirement you need to follow.
The FuelGauge Class: This class will simulate a fuel gauge. Its responsibilities are:
Keep track of the car's current amount of fuel, in gallons (int)
Reports the car's current amount of fuel, in gallons
This MUST be done via operator overloading
Increment the amount of fuel by 1 gallon. This simulated putting fuel in the car. (The car can hold a maximum of 15 gallons.)
This MUST be done via operator overloading
Decrement the amount of fuel by 1 gallon, if the amount of fuel is greater than 0 gallons. This simulates burning fuel as the car runs
This MUST be done via operator overloading
The construction of a fuel gauge creates a fuel gauge with a full tank
The Odometer Class: This class will simulate the car's odometer. Its responsibilities are:
Keep track of the car's current mileage (int)
Reports the car's current mileage
This MUST be done via operator overloading >>
Increments the current mileage by 1 mile. The maximum mileage the odometer can store is 999,999 miles. When the amount is exceeded, the odometer resets the current mileage to 0.
This MUST be done via operator overloading
Works with a FuelGauge object. It should decrease the FuelGauge object's current amount of fuel by 1 gallon for every 24 miles traveled. (The car's fuel economy is 24 mile per gallon.)
The construction of a odometer requires a reference to the FuelGauge that it works with (FuelGauge*).
The Car Class: This class will simulate the car. Its responsibilities are:
Keep track of the car's fuel gauge (FuelGauge*)
Keep track of the car's odometer (Odometer*)
Reports the number of miles drive and how much gas remains in the car.
This MUST be done with via operator overloading >>
Drive a certain amount of miles while consuming gas. Works with the fuel gauge and odometer.
The construction of a car dynamically allocates space for a fuel gauge and a odometer.
Finally create a main program to simulate a Uber driving to 5 different locations, after drive to each location the driver's car reports the miles driven and the number of gallons of gas left, the mileage to the different locations are as follows:
10 miles away
30 miles away
100 miles away
200 miles away
22 miles away
Sample output:

Go a little extra:
Instead of having the schedule list of locations as described above, make your program more interactive, by doing the follow.
Ask how far away is customer?
Allow the user to make this determination
Ask how far does customer need to go
Allow the user to make this determination
After every pick-up and drop-off report the number of miles driven and how much gas remains in the tank
And drive until the Uber is out of gas
Sample output:

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
