Question: Write a JAVA program that determines the position of the hour and minute hands of an analog clock at a moment in time. Using a
Write a JAVA program that determines the position of the hour and minute hands of an analog clock at a moment in time.
Using a 12-hour clock (where the hour hand moves between the integers 1 thru 12 and the minute hand moves between the integers 0 and 59), read the current clock time from the user and then read a time increment to add to or subtract from the current time. For this second time, calculate where the location of the hour and minute hand will be.
Here are some sample program dialogues for you to consider:
Enter the current hour (1-12): 1
Enter the current minute (0-59): 10
Enter the desired time increment (in minutes): 6
Based on these values, the hour hand will be at 1 and the minute hand will be at 16
Enter the current hour (1-12): 10
Enter the current minute (0-59): 20
Enter the desired time increment (in minutes): -50
Based on these values, the hour hand will be at 9 and the minute hand will be at 30
Enter the current hour (1-12): 12
Enter the current minute (0-59): 50
Enter the desired time increment (in minutes): 50
Based on these values, the hour hand will be at 1 and the minute hand will be at 40
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
