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
Basic Computer Science: Write program that asks the user to enter a time duration
Reference No:- TGS02797465

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)