Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class LunchBreak {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String serialName = scanner.nextLine();
- int serialTime = Integer.parseInt(scanner.nextLine());
- int breakTime = Integer.parseInt(scanner.nextLine());
- double neededTime = breakTime / 8.0 + breakTime / 4.0 + serialTime;
- if (neededTime <= breakTime) {
- System.out.printf("You have enough time to watch %s and left with %.0f minutes free time.", serialName, breakTime - Math.floor(neededTime));
- } else {
- System.out.printf("You don't have enough time to watch %s, you need %.0f more minutes.", serialName, Math.ceil(neededTime) - breakTime);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement