Question: BASIC JAVA PLEASE DO NOT USE ARRAYS!! HELP ME UNDERSTAND, THANK YOU! Write a method called daysInMonth() that takes in a month (as an integer)

BASIC JAVA PLEASE DO NOT USE ARRAYS!! HELP ME UNDERSTAND, THANK YOU!

BASIC JAVA PLEASE DO NOT USE ARRAYS!! HELP ME UNDERSTAND, THANK YOU!

Write a method called daysInMonth() that takes in a month (as an integer) and an integer year as parameters and returns the number of days in that month as an integer. For example the call dayslnMonth(1, 2000) should return 31 as there are thirty one days in January(1). If the user inputs a day in Feburary(2) make sure to account for the possibility of a leap year. Rules for leap years can be found here How to determine whether a year is a leap year To determine whether a year is a leap year, follow these steps: 1. If the year is evenly divisible by 4 , go to step 2 . Otherwise, go to step 5. 2. If the year is evenly divisible by 100 , go to step 3 . Otherwise, go to step 4 . 3. If the year is evenly divisible by 400 , go to step 4 . Otherwise, go to step 5. 4. The year is a leap year (it has 366 days). 5. The year is not a leap year (it has 365 days). If the user types in a month that doesn't exist return (1) as an error message. Do the same for any year that is earlier than 1700AD

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!