5-2 then what time (15 points)
Sometimes people use four digits to denote a time, such as 1106 for 11 points and 6 points. Now, your program calculates the end time based on the start time and elapsed time.
Reads two numbers, the first number represents the current time with such a four-digit number, the second number represents the number of minutes, the current time is calculated after so many minutes, and the result is represented as a four-digit number. When the hour is single digit, there is no leading 0, that is, 5:30 is represented as 530. Note that the second number may represent more than 60 minutes, or it may be a negative number.
Input format:
The input gives 2 integers in a row, which is the starting time of the four-digit number, and the number of minutes elapsed, separated by a space. Note: In the start time, when the hour is single digit, there is no leading 0, that is, 5:30 is represented as 530, the elapsed minutes may exceed 60, or it may be a negative number.
Output format:
Outputs a four-bit number indicating the end time. The title guarantees the start and end times within the same day.
Input Sample:
1120 110
Sample output:
1310
Import Java.util.scanner;public class main{public static void Main (string[] args) {Scanner sc = new Scanner (system.in); int time1 = Sc.nextint (); int time2 = Sc.nextint (); int mins = Time1/1000*600+time1%1000/100*60+time1%100;if (time2>=0) { mins +=time2;int hour = mins/60;int minue = mins%60;if (minue==0) {System.out.println (hour+ "" +minue+ "" +minue "); When the hour is single digit, there is no leading 0,}//means that the minutes are 0 also to output two 0else{system.out.println (hour+ "" +minue);} Else{mins+=time2;int hour = Mins/60;int minue = mins%60;if (minue==0) {System.out.println (hour+ "" +minue+ "" +minue);} Else{system.out.println (hour+ "" +minue);}}}
Pat-java-5-2 then what time (15 points)