Advertisement
Stefi16524

Untitled

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