Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program in C to calculate MPH (Miles per Hour) based on miles traveled and the amount of time it took to drive those

Write a program in C to calculate MPH (Miles per Hour) based on miles traveled and the amount of time it took to drive those miles. Ask the user for the number of miles driven (as a double) and the time it took to drive those miles (in minutes, as an integer), and calculate and display the MPH. Create an integer constant to hold the conversion factor to change minutes to hours, and use that constant in the program. You may need to type cast when converting minutes to hours. Have a blank line between the input and the output. Follow the 3 steps in the Information Processing Cycle - Input, Processing, and Output. Make sure the miles traveled is formatted to 1 decimal place and the MPH is formatted to 0 decimal places, and don't forget the ending punctuation. Have a blank line at the end of your program to separate the last line of output from your program from the "Press any key to continue . . .", and do this for all programs that you write. Example Run #1 (bold type is what is entered by the user) Enter the number of miles driven: 100 Enter the number of minutes that it took to drive the 100.0 miles: 75 Based on a trip of 100.0 miles that took 75 minutes, your speed was xx MPH. The example run shows EXACTLY how your program input and output will look.

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

Step: 3

blur-text-image

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 Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions

Question

a. When did your ancestors come to the United States?

Answered: 1 week ago

Question

d. What language(s) did they speak?

Answered: 1 week ago

Question

e. What difficulties did they encounter?

Answered: 1 week ago