JAVA Problem description: You are to write a program called Seasons that prompts the user for a month and day and displays the season in which that date occurs. For reference, we will use the following date cutoffs for the various seasons: Winter December 21 – March 19 Spring March 20th – June 20th Summer June 21st – September 20th Fall September 21st – December 20th Data Validation For this program, you'll write a specific method to perform data validation based on the month and day entered. More specifically: Month – the month entered must be a valid month of the year (January – December). Day – the day entered must be a valid day for that month: January, March, May, July, August, October, December have 1-31 days. April, June, September, November have 1-30 days. February has 1-28 days (do not worry about leap years) Required program decomposition String getMonth(Scanner console) This method is called from the main method and should prompt for the month as a string and return it to the main method. Recall that you must declare the Scanner object in the main method and pass it as a parameter to the method. int getDay(Scanner console) This method is called from main method and should prompt for the day and return it to main. boolean validInput(String inputMonth, int inputDay) This method is called from main and is passed as parameters the month and day entered by the user. The month value may be a combination of uppercase and lowercase letters. The method should determine whether the month and day entered are valid dates based on ensuring that the month is a valid month and the number of days is a valid number of days for that month. This method returns a boolean true to indicate the month/day are valid and false if either the month or day are invalid. String calcSeason(String inputMonth, int inputDay) This method accepts a valid month and valid day from main and determines in what season the date occurs. The month value may be a combination of uppercase and lowercase letters. This method assumes the month/day value has been verified by the validInput method. Returns a string with one of the following values: "winter", "spring", "summer", "fall". void displaySeason(String season) This method displays the results indicating in what season the date entered by the user occurs. Yes, it will be a very small method with only a print statement.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

JAVA

Problem description:
You are to write a program called Seasons that prompts the user for a month and day and displays the season in which that date occurs. For reference, we will use the following date cutoffs for the various seasons:

Winter December 21 – March 19
Spring March 20th – June 20th
Summer June 21st – September 20th
Fall September 21st – December 20th

Data Validation

For this program, you'll write a specific method to perform data validation based on the month and day entered. More specifically:

  1. Month – the month entered must be a valid month of the year (January – December).

  2. Day – the day entered must be a valid day for that month:

    • January, March, May, July, August, October, December have 1-31 days.
    • April, June, September, November have 1-30 days.
    • February has 1-28 days (do not worry about leap years)

Required program decomposition

String getMonth(Scanner console)

This method is called from the main method and should prompt for the month as a string and return it to the main method. Recall that you must declare the Scanner object in the main method and pass it as a parameter to the method.

int getDay(Scanner console)

This method is called from main method and should prompt for the day and return it to main.

boolean validInput(String inputMonth, int inputDay)

This method is called from main and is passed as parameters the month and day entered by the user. The month value may be a combination of uppercase and lowercase letters. The method should determine whether the month and day entered are valid dates based on ensuring that the month is a valid month and the number of days is a valid number of days for that month. This method returns a boolean true to indicate the month/day are valid and false if either the month or day are invalid.

String calcSeason(String inputMonth, int inputDay)

This method accepts a valid month and valid day from main and determines in what season the date occurs. The month value may be a combination of uppercase and lowercase letters. This method assumes the month/day value has been verified by the validInput method. Returns a string with one of the following values: "winter", "spring", "summer", "fall".

void displaySeason(String season)

This method displays the results indicating in what season the date entered by the user occurs. Yes, it will be a very small method with only a print statement.

Sample run 3
enero
15
Run:
Enter the month: enero
Enter day: 15
Invalid date. Program cannot continue.
Sample run 4
Input:
June
31
Enter the month: June
Enter day: 31
Invalid date. Program cannot continue.
Transcribed Image Text:Sample run 3 enero 15 Run: Enter the month: enero Enter day: 15 Invalid date. Program cannot continue. Sample run 4 Input: June 31 Enter the month: June Enter day: 31 Invalid date. Program cannot continue.
Sample run 1
Input:
APRIL
11
Run:
Enter the month: aPRIL
Enter day: 11
This date occurs in the spring.
Sample run 2
Input:
December
22
Run:
Enter the month: December
Enter day: 22
This date occurs in the winter.
Transcribed Image Text:Sample run 1 Input: APRIL 11 Run: Enter the month: aPRIL Enter day: 11 This date occurs in the spring. Sample run 2 Input: December 22 Run: Enter the month: December Enter day: 22 This date occurs in the winter.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY