Advertisement
veronikaaa86

07. Working Hours

Jul 17th, 2021
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. package conditionalStatementsAdvanced;
  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 dayOfWeek = scanner.nextLine();
  11.  
  12. String type = "";
  13. if (hour >= 10 && hour <= 18) {
  14. if (dayOfWeek.equals("Monday") ||
  15. dayOfWeek.equals("Tuesday") ||
  16. dayOfWeek.equals("Wednesday") ||
  17. dayOfWeek.equals("Thursday") ||
  18. dayOfWeek.equals("Friday") ||
  19. dayOfWeek.equals("Saturday")){
  20. type = "open";
  21. } else {
  22. type = "closed";
  23. }
  24. } else {
  25. type = "closed";
  26. }
  27.  
  28. System.out.println(type);
  29. }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement