A_Marinov

Untitled

May 8th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SleepyCatTom {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         int days = Integer.parseInt(scan.nextLine());
  7.         int normPlay = 30000;
  8.         double restDays = days * 127.0;
  9.         double workingDays = (365 - days) * 63.0;
  10.         double total = restDays + workingDays;
  11.         if (total > +normPlay) {
  12.             double rest = total - normPlay;
  13.             double restHours = rest % 60;
  14.             double restMinutes = (rest - restHours) / 60;
  15.             System.out.println("Tom will run away");
  16.             System.out.printf("%.0f hours and %.0f minutes more for play", restMinutes, restHours);
  17.         } else {
  18.             double rest = normPlay - total;
  19.             double restHours = rest % 60;
  20.             double restMinutes = (rest - restHours) / 60;
  21.             System.out.println("Tom sleeps well");
  22.             System.out.printf("%.0f hours and %.0f minutes less for play", restMinutes, restHours);
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment