Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Icdt 88 2nd International Conference On Database Theory Bruges Belgium August 31 September 2 1988 Proceedings Lncs 326

Authors: Marc Gyssens ,Jan Paredaens ,Dirk Van Gucht

1st Edition

3540501711, 978-3540501718

More Books

Students also viewed these Databases questions