Answered step by step
Verified Expert Solution
Link Copied!

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!

image text in transcribed

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

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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

Why should an individual manager be interested in supporting HR?

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

d. How will lack of trust be handled?

Answered: 1 week ago