• Source
    1. // Assignment 01#04 due date 6/5/2018
    2. // Page 122#02 Seasons
    3. // #08 Michael Y. C. Shih @ 107 Android Programming Class, EEC, UCH
    4.  
    5. import java.util.Scanner;
    6.  
    7. class p122_2 {
    8.  
    9. public static void main(String[] args) {
    10. // TODO Auto-generated method stub
    11. Scanner scan = new Scanner(System.in);
    12. System.out.print("Enter the month: ");
    13. int month = scan.nextInt();
    14. scan.close();
    15. switch (month) {
    16. case 2:;
    17. case 3:;
    18. case 4:
    19. System.out.println("Month " + month + " is Spring.");
    20. break;
    21. case 5:;
    22. case 6:;
    23. case 7:
    24. System.out.println("Month " + month + " is Summer.");
    25. break;
    26. case 8:;
    27. case 9:;
    28. case 10:
    29. System.out.println("Month " + month + " is Autumn.");
    30. break;
    31. case 11:;
    32. case 12:;
    33. case 1:
    34. System.out.println("Month " + month + " is Winter.");
    35. break;
    36. default:
    37. System.out.println(month + " is not a month.");
    38. break;
    39. }
    40. }
    41. }