Advertisement
MilaDimitrovaa

Pospaliva kotka tom

Nov 3rd, 2019
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.83 KB | None | 0 0
  1. package homework222;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class sleepycattom {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scan = new Scanner(System.in);
  9.            int pochivka = scan.nextInt();
  10.            int rabotnidni = 365 - pochivka;
  11.            int totalPlayMinutes = rabotnidni * 63 + pochivka * 127;
  12.            double difference = Math.abs(30000 - totalPlayMinutes);
  13.            double hours = difference / 60;
  14.            double minutes = difference % 60;
  15.            
  16.            if(totalPlayMinutes > 30000) {
  17.                System.out.println("Tom will run away");
  18.                System.out.printf("%.0f hours and %.0f minutes more to play" , Math.floor(hours) ,Math.floor(minutes));
  19.            }else {
  20.                System.out.println("Tom sleeps well");
  21.                System.out.printf("%.0f hours and %.0f minutes less to play" , Math.floor(hours),Math.floor(minutes));
  22.            }
  23.        
  24.        
  25.     }
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement