Question: C++ Write a simple program that contains the following features: Function main calls functions class Car containing the public method API; API calls the private

C++

Write a simple program that contains the following features:

Function main calls functions class Car containing the public method API; API calls the private methods: simulator_input, run_simulator

Use a local variable myCar defined as a struct data_car declared in the method API; This struct contains: vehicle_name, terrain, speed, tank_level

Method simulator_input: Ask how TOUGH is the terrain (1: easy, 2: tough, 3: really hard) do it in a method named simulator_input; select the average speed to drive (a: slow = minus 3%, b: medium = minus 6%, c: fast = minus 8%); select tank level for the fuel when you start to drive (100.00; 800.00; or 50.00)

Use a pointers to access the input values provided by the user. Print on every loop iteration the fuel level.

Call the method run_simulator; inside it put your parameters to run inside a loop that keeps running for as long as your vehicle has fuel. Every time the loop goes through the rule applies to the tank level: tank_level = tank_level - (TOUGH * average_speed)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!