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