Respuesta :
Code:
import java.util.Scanner; //to get input
public class Season
//this class designed to obtain appropriate season name
{
public static void main(String[] args)
{
Scanner inputstring = new Scanner(System.in);
System.out.println("Enter the month and day as integers with a space between Eg. January 21");
int month = inputstring.nextInt();
int day = inputstring.nextInt();
//seasons that remains the same for the whole month
if ( (month == 1) || (month == 2)) //Jan and feb
System.out.println("season: Winter");
else if ( (month == 4) || (month == 5)) //april and may
System.out.println("season: Spring");
else if ( (month == 7) || (month == 8)) //july & august
System.out.println("season: Summer");
else if ( (month == 10)|| (month == 11)) //october & november
System.out.println("season: Fall");
//Months whose season changes according to the date
else if ( (month == 3) && (day <= 19 ))
System.out.println("season: Winter");
else if ( (month == 3) && (day >= 20 ))
System.out.println("season: Spring");
else if ( (month == 6) && (day <= 20 ))
System.out.println("season: Spring");
else if ( (month == 6) && (day >= 21 ))
System.out.println("season: Summer");
else if ( (month == 9) && (day <= 20 ))
System.out.println("season: Summer");
else if ( (month == 9) && (day >= 21 ))
System.out.println("season: Autumn");
else if ( (month == 12) && (day <= 21 ))
System.out.println("season: Autumn");
else if ( (month == 12) && (day >= 22 ))
System.out.println("season: Winter");
}
}