53.4k views
5 votes
Write a program that takes a date as input and outputs the date's season. The input is a string to represent the month and an int to represent the day. If the input is April 11, the output is: spring In addition, check if the string and int are valid (an actual month and day). If the input is invalid, the output is: invalid The dates for each season are spring: March 20-June 20 summer: June 21 - September 21 autumn: September 22 - December 20 winter: December 21 -March 19

1 Answer

7 votes

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)

}

User Weichao
by
6.1k points