Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3: [20 marks] Find the number of days in a month (filename: DaysInMonth.java ) Design an algorithm and then write a program that prompts

Problem 3: [20 marks] Find the number of days in a month (filename: DaysInMonth.java)

Design an algorithm and then write a program that prompts the user to enter a month in number and a year, and displays the number of days in that month on the console. If the month is 2, your program should check if it is a leap year. In a leap year there are 29 days in February. Assume that the user will enter all the input correctly.

For example, if the user entered month 2 and year 2016, the program should display that February 2016 has 29 days. If the user entered month 3 and year 2019, the program should display that March 2019 has 31 days.

Use switch statement to check the month number. To check whether it is a leap year should be performed under the case of month 2 only.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago

Question

3. What are potential solutions?

Answered: 1 week ago