Advertisement
Dido09

SleepyCatTom

Jan 2nd, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SleepyCatTom {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner scan = new Scanner(System.in);
  8. int holidays = Integer.parseInt(scan.nextLine());
  9. int workdays = 365 - holidays;
  10. int totalPlayTime = workdays * 63 + holidays * 127;
  11. double difference = Math.abs(totalPlayTime - 30000);
  12. double hours = difference / 60;
  13. double mins = difference % 60;
  14. if(totalPlayTime > 30000){
  15. System.out.println("Tom will run away!");
  16. System.out.printf("%d hours and %d mins more for play.", (int)Math.floor(hours), (int)Math.floor(mins));
  17. } else {
  18. System.out.println("Tom sleeps well");
  19. System.out.printf("%d hours and %d mins less for play.", (int)Math.floor(hours), (int)Math.floor(mins));
  20. }
  21.  
  22. }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement