Advertisement
veronikaaa86

07.Working Hours

Nov 13th, 2021
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. package advancedConditionalStatements;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P07WorkingHours {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. int hour = Integer.parseInt(scanner.nextLine());
  10. String day = scanner.nextLine();
  11.  
  12. if (day.equals("Monday")) {
  13. if (hour >= 10 && hour <= 18) {
  14. System.out.println("open");
  15. } else {
  16. System.out.println("closed");
  17. }
  18. } else if (day.equals("Tuesday")) {
  19. if (hour >= 10 && hour <= 18) {
  20. System.out.println("open");
  21. } else {
  22. System.out.println("closed");
  23. }
  24. } else if (day.equals("Wednesday")) {
  25. if (hour >= 10 && hour <= 18) {
  26. System.out.println("open");
  27. } else {
  28. System.out.println("closed");
  29. }
  30. } else if (day.equals("Thursday")) {
  31. if (hour >= 10 && hour <= 18) {
  32. System.out.println("open");
  33. } else {
  34. System.out.println("closed");
  35. }
  36. } else if (day.equals("Friday")) {
  37. if (hour >= 10 && hour <= 18) {
  38. System.out.println("open");
  39. } else {
  40. System.out.println("closed");
  41. }
  42. } else if (day.equals("Saturday")) {
  43. if (hour >= 10 && hour <= 18) {
  44. System.out.println("open");
  45. } else {
  46. System.out.println("closed");
  47. }
  48. } else if (day.equals("Sunday")) {
  49. if (hour >= 10 && hour <= 18) {
  50. System.out.println("closed");
  51. } else {
  52. System.out.println("closed");
  53. }
  54. }
  55. }
  56. }
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement