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