Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Database And Expert Systems Applications 19th International Conference Dexa 2008 Turin Italy September 2008 Proceedings Lncs 5181

Authors: Sourav S. Bhowmick ,Josef Kung ,Roland Wagner

2008th Edition

3540856536, 978-3540856535

More Books

Students also viewed these Databases questions

Question

Select suitable tools to analyze service problems.

Answered: 1 week ago