Problem

(Practice)a. Write, compile, and run a C++ program that displays the following prompts:Ent...

(Practice)

a. Write, compile, and run a C++ program that displays the following prompts:

Enter the miles driven:

Enter the gallons of gas used:

After each prompt is displayed, your program should use a cin statement to accept data from the keyboard for the displayed prompt. After the number for gallons of gas used has been entered, your program should calculate and display the miles per gallon (mpg). This value should be included in a message and calculated by using the formula miles per gallon = miles / gallons used. Verify your program by using the following test data:

Test data set 1: miles = 276, gas = 10 gallons

Test data set 2: miles = 200, gas = 15.5 gallons

After finishing your verification, use your program to complete the following chart. (Make sure to convert the miles driven to kilometers driven and gallons used to liters used, and then compute the kilometers per liter.)

Miles Driven

Gallons Used

Mpg

Km Driven

Liters Used

Km/L

250

16.00

 

 

 

 

275

18.00

 

 

 

 

312

19.54

 

 

 

 

296

17.39

 

 

 

 


b. For the program written for Exercise a, determine how many verification runs are required to make sure the program is working correctly, and give a reason to support your answer. 

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 3.4