Write program that asks the user to enter a time duration


Write program that asks the user to enter a time duration in hours, minutes, and seconds and then displays the time in terms of hours in decimal format. There are 60 minutes in an hour, and there are 60 seconds in a minute. Represent these number of minutes in an hours and number of seconds in a minute as constant in your program.You should use a separate variable for each input value.Please make sure that minutes and seconds are less than and equal to 59. If the users enter this more than 59 or negative it should be asking him to reenter the information.

A sample run should look like this (user input is in bold):

Enter a hours, minutes, and seconds:

First, enter the hours: 10

Next, enter the minutes: 30

Finally, enter the seconds:30

10 hours, 30 minutes, 30 seconds = 10.50833 hours

At the end of the inputs and after display of the results, you should ask the user if he wants to continue, and if the input is 'Y' you should repeat the process.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write program that asks the user to enter a time duration
Reference No:- TGS02845588

Now Priced at $20 (50% Discount)

Recommended (96%)

Rated (4.8/5)