Answered step by step
Verified Expert Solution
Link Copied!

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 1) the current time, 2) the current day of the week, and 3) 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 12-hour format: "hh:mmam" or "hh:mmpm"
Examples: 08:00am,09:30pm,11:35pm
Your program should keep asking if the time the user enters is invalid.
The valid times are from 00:00am till 11:59pm, or 01:00am till 12:59am 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 23 hours 59 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 12hour format nicely.

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

More Books

Students also viewed these Databases questions

Question

=+professionalism and competency in handling global HR issues?

Answered: 1 week ago