Nackey

tom the cat

Jul 18th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.util.Scanner;
  3.  
  4. import static java.lang.System.*;
  5.  
  6. public class Tomcat {
  7.     public static void main(String[] args) {
  8.         Scanner sc = new Scanner(in);
  9.  
  10.         int dayOff = Integer.parseInt(sc.nextLine());
  11.         int work = 365 - dayOff;
  12.         int workplay = work * 63;
  13.         int offdayplay = dayOff * 127;
  14.         int sumplay = workplay + offdayplay;
  15.         int norm = 30000;
  16.         int diff = (norm - sumplay);
  17.         int hours = Math.abs(diff/60);
  18.         int minutes = Math.abs(diff%60);
  19.  
  20.         if (sumplay > norm) {
  21.             System.out.println("Tom will run away");
  22.             System.out.printf("%d hours and %d minutes more for play", hours, minutes);
  23.         }else{
  24.             if (sumplay <= norm){
  25.                 System.out.println("Tom sleeps well");
  26.                 System.out.printf("%d hours and %d minutes less for play", hours, minutes);
  27.             }
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment