Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package conditionalStatemnents;
- import java.util.Scanner;
- public class P03TimePlus15Minutes {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hour = Integer.parseInt(scanner.nextLine());
- int minutes = Integer.parseInt(scanner.nextLine());
- int allMinutes = (hour * 60) + minutes + 15;
- int newHour = allMinutes / 60;
- int newMin = allMinutes % 60;
- if (newHour > 23) {
- newHour = 0;
- System.out.printf("%d:%02d", newHour, newMin);
- } else {
- System.out.printf("%d:%02d", newHour, newMin);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement