Question: THIS NEEDS TO BE DONE IN C# Write a program that asks the user to enter the miles driven on a trip and the number

THIS NEEDS TO BE DONE IN C#

Write a program that asks the user to enter the miles driven on a trip and the number of gallons used. The program then calculates the miles per gallon(mpg) the vehicle had during the trip. The program should NOT crash if the user input is not in the format of a proper number(double). Instead, display the following message:

The data entered is not in the format of a number. Please re-enter your data.

The program should repeatedly ask the user for numbers until valid data has been entered. Once the data is validated, the mpg should be calculated and outputted.

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!