ralitsa_d

TimePlus15Minutes

Jan 18th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TimePlus15Minutes {
  4. public static void main(String[] args) {
  5. Scanner scan = new Scanner(System.in);
  6.  
  7. int hours = Integer.parseInt(scan.nextLine());
  8. int minutes = Integer.parseInt(scan.nextLine());
  9.  
  10. if(minutes >= 45){
  11. minutes += 15 - 60;
  12.  
  13. if (hours == 23){
  14. hours = 0;
  15. }
  16. else{
  17. hours++;
  18. }
  19. }
  20. else{
  21. minutes += 15;
  22. }
  23.  
  24. System.out.printf("%-15d:%15d", hours, minutes);
  25. }
  26. }
Add Comment
Please, Sign In to add comment