You are given an input representing the current military time in hours and minutes. You are also given two additional values, h and m. These are the hours and minutes that pass. Display the new current time. Input Format First line is a String value representing the current time. Second line is the number of elapsed hours. Third line is the number of elapsed minutes. Constraints The String representing the current time will always be 5 characters in length. The first two characters will be a value anywhere from 00 to 23 (midnight to 11pm). The third character will be a ':'. The last two characters will be a value anywhere from 00 to 59 (number of minutes of the hour). The elapsed hours value will be from 0 to 2 billion. The elapsed minutes value will be from 0 to 2 billion. Output Format Display a 5 character String representing the current military time after the elapsed hours and minutes have passed. Sample Input 0 08:30 2 15 Sample Output 0 10:45 Explanation 0 The starting time is 8:30am. in 2 hours and 15 minutes it will be 10:45am Sample Input 1 11:22 1 50 Sample Output 1 13:02 Explanation 1 It is 11:22. (Remember military time is from 0 to 23) in 1 hour and 50 minutes it will be 1:02pm which is 13:02 in military time
Control structures
Control structures are block of statements that analyze the value of variables and determine the flow of execution based on those values. When a program is running, the CPU executes the code line by line. After sometime, the program reaches the point where it has to make a decision on whether it has to go to another part of the code or repeat execution of certain part of the code. These results affect the flow of the program's code and these are called control structures.
Switch Statement
The switch statement is a key feature that is used by the programmers a lot in the world of programming and coding, as well as in information technology in general. The switch statement is a selection control mechanism that allows the variable value to change the order of the individual statements in the software execution via search.
You are given an input representing the current military time in hours and minutes. You are also given two additional values, h and m. These are the hours and minutes that pass. Display the new current time.
Input Format
First line is a String value representing the current time.
Second line is the number of elapsed hours.
Third line is the number of elapsed minutes.
Constraints
The String representing the current time will always be 5 characters in length. The first two characters will be a value anywhere from 00 to 23 (midnight to 11pm). The third character will be a ':'. The last two characters will be a value anywhere from 00 to 59 (number of minutes of the hour).
The elapsed hours value will be from 0 to 2 billion. The elapsed minutes value will be from 0 to 2 billion.
Output Format
Display a 5 character String representing the current military time after the elapsed hours and minutes have passed.
Sample Input 0
08:30 2 15
Sample Output 0
10:45
Explanation 0
The starting time is 8:30am.
in 2 hours and 15 minutes it will be 10:45am
Sample Input 1
11:22 1 50
Sample Output 1
13:02
Explanation 1
It is 11:22. (Remember military time is from 0 to 23)
in 1 hour and 50 minutes it will be 1:02pm which is 13:02 in military time
Step by step
Solved in 3 steps with 2 images