Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class DayOfWeek {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner input = new Scanner(System.in);
  8. System.out.println("enter the day of the week as an integer between 1 and 7: ");
  9.  
  10. int day = input.nextInt();
  11.  
  12. if (day == 1)
  13. System.out.println("week day");
  14. else if (day == 2)
  15. System.out.println("week day");
  16. else if (day == 3)
  17. System.out.println("week day");
  18. else if (day == 4)
  19. System.out.println("week day");
  20. else if (day == 5)
  21. System.out.println("week day");
  22. else if (day == 6)
  23. System.out.println("weekend");
  24. else if (day == 7)
  25. System.out.println("weekend");
  26. else
  27. System.out.println("Invalid week day.");
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement