Question
C++ Question: Need help with code. Need to write program with these specifications: Write a program that asks the user to enter a time duration
C++ Question: Need help with code.
Need to write program with these specifications:
Write a 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started