Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Project: Exam_24_April_2016 - created by borkins on 2017-05-15.
- */
- import java.util.Scanner;
- public class _02_SleepyTomCat
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- int holidays = Integer.parseInt(console.nextLine());
- int workDays = 365 - holidays;
- int playTime = (workDays * 63) + (holidays * 127);
- int diffNorm = Math.abs(30000 - playTime);
- int hours = diffNorm / 60;
- int minutes = diffNorm % 60;
- if (playTime > 30000) {
- System.out.println("Tom will run away");
- System.out.printf("%d hours and %d minutes more for play", hours, minutes);
- }
- else {
- System.out.println("Tom sleeps well");
- System.out.printf("%d hours and %d minutes less for play", hours, minutes);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment