Question: This is for JAVA Every school morning Steve is woken up by the sound of his alarmclock. Since he is a bit forgetful, quite often
This is for JAVA
Every school morning Steve is woken up by the sound of his alarmclock. Since he is a bit forgetful, quite often he leaves the alarmon Saturday morning too. That’s not too bad though, since he feelsgood when he realizes he doesn’t have to get up from his warm andcozy bed.
He likes that so much that he would like to experience that onother days of the week too! His friend Justin offered this simplesolution: set his alarm clock 45 minutes early, and he can enjoythe comfort of his bed, fully awake, for 45 minutes each day.
Steve decided to heed Justin’s advice, however Steve’s alarmclock uses 24-hour notation and Steve has issues with adjusting thetime. Help Steve and write a program that will take one time stamp,in 24-hour notation, and print out a new time stamp, 45 minutesearlier, also in 24-hour notation.
If you are unfamiliar with 24-hour time notation yourself, youmight be interested to know it starts with 0:00 (midnight) and endswith 23:59 (one minute before midnight).
Input
The first and only line of input will contain exactly twointegers H and M (0 ? H ? 23, 0 ? M ? 59) separated by a singlespace, the input time in 24-hour notation. H denotes hours and Mminutes. Ensure your program does not terminate if there is badinput and can recover gracefully.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
