Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package advancedConditionalStatements;
- import java.util.Scanner;
- public class P07WorkingHours {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int hour = Integer.parseInt(scanner.nextLine());
- String day = scanner.nextLine();
- if (day.equals("Monday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("open");
- } else {
- System.out.println("closed");
- }
- } else if (day.equals("Tuesday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("open");
- } else {
- System.out.println("closed");
- }
- } else if (day.equals("Wednesday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("open");
- } else {
- System.out.println("closed");
- }
- } else if (day.equals("Thursday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("open");
- } else {
- System.out.println("closed");
- }
- } else if (day.equals("Friday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("open");
- } else {
- System.out.println("closed");
- }
- } else if (day.equals("Saturday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("open");
- } else {
- System.out.println("closed");
- }
- } else if (day.equals("Sunday")) {
- if (hour >= 10 && hour <= 18) {
- System.out.println("closed");
- } else {
- System.out.println("closed");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement