Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Test your skills: Instructions: For this assignment you are tasked with simulating an Uber driver. To complete this task we will simplify a

In C++

image text in transcribed

Test your skills:

image text in transcribed

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: 1. Keeo track of the car's current amount of fuel, in gallons (int) 2. Reports the car's current amount of fuel, in gallons 3. Increment the amount of fuel by 1 gallon. This simulated putting fuel in the car. (The car can hold a maximum of 15 gallons.) 4. 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 5. The construction of a fuel gauge creates a fuel gauge with a full tank 1. Keep track of the car's current mileage (int) o This MUST be done via operator overloading o This MUST be done via operator overloading o This MUST be done via operator overloading . The Odometer Class: This class will simulate the car's odometer. Its responsibilities are 2. Reports the car's current mileage o This MUST be done via operator overloading >> 3. 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 to0 o This MUST be done via operator overloading 4. 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.) 5. 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 1. Keep track of the car's fuel gauge (FuelGauge*) 2. Keep track of the car's odometer (Odometer*) 3. Reports the number of miles drive and how much gas remains in the car. o This MUST be done with via operator overloading>> 4. Drive a certain amount of miles while consuming gas. Works with the fuel gauge and odometer 5. 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: 1, 10 miles away 2. 30 miles away 3. 100 miles away 4. 200 miles away 5. 22 miles away 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: 1. Keeo track of the car's current amount of fuel, in gallons (int) 2. Reports the car's current amount of fuel, in gallons 3. Increment the amount of fuel by 1 gallon. This simulated putting fuel in the car. (The car can hold a maximum of 15 gallons.) 4. 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 5. The construction of a fuel gauge creates a fuel gauge with a full tank 1. Keep track of the car's current mileage (int) o This MUST be done via operator overloading o This MUST be done via operator overloading o This MUST be done via operator overloading . The Odometer Class: This class will simulate the car's odometer. Its responsibilities are 2. Reports the car's current mileage o This MUST be done via operator overloading >> 3. 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 to0 o This MUST be done via operator overloading 4. 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.) 5. 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 1. Keep track of the car's fuel gauge (FuelGauge*) 2. Keep track of the car's odometer (Odometer*) 3. Reports the number of miles drive and how much gas remains in the car. o This MUST be done with via operator overloading>> 4. Drive a certain amount of miles while consuming gas. Works with the fuel gauge and odometer 5. 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: 1, 10 miles away 2. 30 miles away 3. 100 miles away 4. 200 miles away 5. 22 miles away

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

Case Studies In Business Data Bases

Authors: James Bradley

1st Edition

0030141346, 978-0030141348

More Books

Students also viewed these Databases questions

Question

6. Describe why communication is vital to everyone

Answered: 1 week ago