borkins

Exam 24-Apr-2016 - 02. Sleepy Tom Cat

May 16th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. /**
  2.  * Project: Exam_24_April_2016 - created by borkins on 2017-05-15.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _02_SleepyTomCat
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.    
  13.         int holidays = Integer.parseInt(console.nextLine());
  14.    
  15.         int workDays = 365 - holidays;
  16.         int playTime = (workDays * 63) + (holidays * 127);
  17.         int diffNorm = Math.abs(30000 - playTime);
  18.         int hours = diffNorm / 60;
  19.         int minutes = diffNorm % 60;
  20.    
  21.         if (playTime > 30000) {
  22.             System.out.println("Tom will run away");
  23.             System.out.printf("%d hours and %d minutes more for play", hours, minutes);
  24.         }
  25.         else {
  26.             System.out.println("Tom sleeps well");
  27.             System.out.printf("%d hours and %d minutes less for play", hours, minutes);
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment