Question: Write a program that does the following: ( a ) It asks for the number of miles the person traveled on a recent trip and

Write a program that does the following: (a) It asks for the number of miles the person
traveled on a recent trip and stores it in nMiles; (b) it asks for the average miles per gallon
the person got on the trip and stores it in milesPerGallon; (c) it asks for the average price
per gallon, paid for gas on the trip and stores it in avgPrice; (d) it calculates the cost of
the trip and stores it in tripCost; (e) it displays a message such as You traveled 800
miles, got 31.3 miles per gallon on average, paid $2.49 per gallon on average, and paid a
total of $63.64 for gas..(f) it checks whether tripCost is less than $500. If it is less than
$500, the program should display a second message such as You will be reimbursed for
your trip cost in your next paycheck. If the tripCost exceeds $500, the program should
display a message such as You need to fill out the expense report to be reimbursed.

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 Programming Questions!