Advertisement
veronikaaa86

Tom

Oct 31st, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. package Exam24April2016;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P02_SleepyTom {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int countDaysOff = Integer.parseInt(scanner.nextLine());
  10.  
  11.         double daysOffGame = countDaysOff*127;
  12.         double daysWorkGame = (365-countDaysOff)*63;
  13.         double gameTime = daysOffGame+daysWorkGame;
  14.  
  15.         int need = 0;
  16.         int left = 0;
  17.         int hours = 0;
  18.         int minutes = 0;
  19.  
  20.         if (gameTime<=30000) {
  21.             left=30000-(int) gameTime;
  22.             hours=left/60;
  23.             minutes=left%60;
  24.             System.out.printf("Tom sleeps well%n%d hours and %d minutes less for play", hours, minutes);
  25.         } else {
  26.             need=(int)gameTime-30000;
  27.             hours=need/60;
  28.             minutes=need%60;
  29.             System.out.printf("Tom will run away%n%d hours and %d minutes more for play", hours, minutes);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement