Question: The following algorithm yields the season (Spring, Summer, Fall, or Winter) for a given month and day. Using Java, write a program that prompts the

The following algorithm yields the season (Spring, Summer, Fall, or Winter) for a given month and day.The following algorithm yields the season (Spring, Summer, Fall, or Winter) for

Using Java, write a program that prompts the user for a month and day and then prints the season, as determined by this algorithm. Use a class Date with a method getSeason. (A skeleton code is provided).

You should test your code with (1) month = 2, date = 22

(2) month = 6, date = 21

(3) month = 12, date = 20

(4) month = 12, date = 22

(5) month = 9, date = 22

If month is 1, 2, or 3, season - "Winter" Else if month is 4, 5, or 6, season - "Spring Else if month is 7, 8, or 9, season "Summer" Else if month is 10, 11, or 12, season - "Fall" If month is divisible by 3 and day >-21 If season is "Winter", season - "Spring" Else if season is "Spring", season - "Summer" Else if season is "Summer", season - "Fall" Else season - "Winter

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!