Question: Write a Java program that prompts the user for a month and day and then prints the season determined by the following rules. Spring 3/21


Write a Java program that prompts the user for a month and day and then prints the season determined by the following rules. Spring 3/21 - 6/20 Summer 6/21 - 9/20 Fall 9/21 - 12/20 Winter 12/21 - 3/20 If an invalid value of month (12) or invalid day is input, the program should display an error message and stop. Notice that whether the day is invalid depends on the month! You may assume that the user will never enter anything other than integers (no random strings or floats will be tested.) Below are some examples of the required I/O behavior, where the user's input is shown in bold. Below are some examples of the required I/O behavior, where the user's input is shown in bold. /cs1400/project $ java Season enter month (1-12): 0 Invalid month! 51400/project ~/cs1400/project $ java Season enter month (1-12): 1 enter day (1-31): 32 Invalid day! ~/051400/project $ java Season enter month (1-12): 2 enter day (1-28): 30 Invalid day! -/cs1400/project s java Season enter month (1-12): 6 enter day (1-30): 30 6/30 is in the Summer season
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
