Question: Programming Activity Write a program that prompts the user to enter the month and year and displays the number of days in the month, check
Programming Activity Write a program that prompts the user to enter the month and year and displays the number of days in the month, check the sample output below. Notice that in a leapyear, there are 29 days in February otherwise, there are 28 days. .Use ONE switch statement to determine name of month and days in that month, in the case of February, decide whether there are 28 days or 29 days (if the year entered is a leap year, then there are 29 days in February, otherwise, there are 28 days, check the presentation we did in class) . Do not forget to include break; at the end of each case If you got an error message, saying that you need to initialize a certain variable, if that variable is an int, initialize it to 0 (e.g. int x-0% if the variable is a double, initialize it to 0.0 (e.g. double x-0.0); if the variable is a String, initialize it to an empty string eg. String x-*). You can name your program DaysMonth java When done, raise your hand to let the TA know that you are ready to demonstrate your code for grading // import statement (a), class header, and main method header /7declare variables for the inputs and outputs prompt for input // process // display the output Sample Output Enter the month (enter 1 for Jan, 2 for Feb, etc.): 2 Enter the year: 2019 February 2019 has 28 days 2 Enter the month (enter 1 for Jan, 2 for Feb, etc.):3 Enter the year: 2020 March 2020 has 31 days
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
