Question: D - Months This class will be coded by you from scratch. Write a program Months that prompts the user to enter a month (1

D - Months

This class will be coded by you from scratch.

  • Write a program Months that prompts the user to enter a month (1 = January, 2 = February, and so on) and then prints the number of days of the month.

  • For example, February would result in 28 days.

Months should print the output shown here (numbers in red are entered by the user):

Enter the corresponding numerical value of a month: 2 February has 28 days.

If the user types an invalid entry, Months should print the following:

Enter the corresponding numerical value of a month: 42 Invalid entry. There are only 12 months.

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!