Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started