Question
Can someone please assist me with this? I can get this to work using a switch statement but I am struggling when it comes to
Can someone please assist me with this? I can get this to work using a switch statement but I am struggling when it comes to using an array or arraylist to make this Java Coding project work. Any help would be greatly appreciated!
Given the poem:
Thirty days hath September April, June, and November All the rest have thirty-one with February's 28 to make it fun. Leap Year happening one in four, Gives February one day more.
Write a program that does the following:
1. Prompts the user for a month string (January, February, ...). Validate the input month string against an array of month's, and prompt the user again if the String entered is not a valid month.
2. Prompts the user for a year (e.g. 2016).
3. For months with 31 days, output the phrase "all the rest have thirty-one". For September, the phrase "Thirty days hath September". For April, June, and November the phrase "April, June, and November". For February, if the year is not a leap year, output the phrase "with February's 28 to make it fun.". If the use did supply a leap year (and the user supplied February as the month), output the phrase "Leap Year happening one in four, Gives February one day more."
4.Note. Since this chapter covers Arrays and ArrayList objects, I expect your solution to utilize these facilities. The specifics of this is up to you (after all, this is your program :) ), so I am making specific requirements regarding this, other than you show learnings from chapter 7.
Please make sure you comment your code thoroughly.
The code should be nicely formatted and should use proper variables.
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