Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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!
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
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