Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine();
- int date = Integer.parseInt(scanner.nextLine());
- // Winter December 21 to 19 March
- // Spring 20 March to 20 June
- // Summer June 21 to 21 September
- // Autumn 22 September to 20 December
- switch (month) {
- case "January":
- case "February":
- System.out.println("Winter");
- break;
- case "March":
- if (date <= 19) {
- System.out.println("Winter");
- } else {
- System.out.println("Spring");
- }
- break;
- case "April":
- case "May":
- System.out.println("Spring");
- break;
- case "June":
- if (date <= 20) {
- System.out.println("Spring");
- } else {
- System.out.println("Summer");
- }
- break;
- case "July":
- case "August":
- System.out.println("Summer");
- break;
- case "September":
- if (date <= 21) {
- System.out.println("Summer");
- } else {
- System.out.println("Autumn");
- }
- break;
- case "October":
- case "November":
- System.out.println("Autumn");
- break;
- case "December":
- if (date <= 21) {
- System.out.println("Autumn");
- } else {
- System.out.println("Winter");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement