Advertisement
galinyotsev123

ProgBasicsJavaBook3.2SimpleConditions03SleepyTomCat

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