Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that will ask the user for 1 ) the current time, 2 ) the current day of the week, and 3 )
Write a program that will ask the user for the current time, the current day of the week, and how long the timer should be and display the time and day of the week when the timer ends.
Specifically, your program should do the following:
Ask the user for the current time:
Assume the user enters the time in the hour format: hh:mmam" or hh:mmpm
Examples: :am:pm:pm
Your program should keep asking if the time the user enters is invalid.
The valid times are from :am till :pm or :am till :am the next day. You can do it either way.
Ask the user for the day of the week:
If the user enters anything other than Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday, your program should ask again until they enter a valid value.
Ask the user for the length of the timer in the format of hh:mm
hh: is the number of hours of the timer
mm: is the number of minutes of the timer
For simplicity, we longest timer we allow will be hours minutes.
Ask the user for the timer length again if the timer length is out of the range
Calculate and print the time and day of week when the timer ends and print the result time in hour format nicely.
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