od in Java named daysInMonth that accepts a month (an integer between 1 and 12) as a parameter and returns the number of days in that month in this year. For example, the call daysInMonth(9) would return 30 because September has 30 days. Assume that the code is

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Write a method in Java named daysInMonth that accepts a month (an integer between 1 and 12) as a parameter and returns the number of days in that month in this year. For example, the call daysInMonth(9) would return 30 because September has 30 days. Assume that the code is not being run during a leap year (that February always has 28 days).

 

### Number of Days in Each Month

This chart provides a detailed overview of the number of days in each month.

| Month  | 1 Jan | 2 Feb | 3 Mar | 4 Apr | 5 May | 6 Jun | 7 Jul | 8 Aug | 9 Sep | 10 Oct | 11 Nov | 12 Dec |
|--------|-------|-------|-------|-------|-------|-------|-------|-------|-------|--------|--------|--------|
| Days   | 31    | 28    | 31    | 30    | 31    | 30    | 31    | 31    | 30    | 31     | 30     | 31     |

- **January:** 31 days
- **February:** 28 days (29 days in a leap year)
- **March:** 31 days
- **April:** 30 days
- **May:** 31 days
- **June:** 30 days
- **July:** 31 days
- **August:** 31 days
- **September:** 30 days
- **October:** 31 days
- **November:** 30 days
- **December:** 31 days

**Note:** February typically has 28 days; however, it has 29 days during a leap year. Leap years occur every four years and can be determined if the year is divisible by 4, except for end-of-century years, which must be divisible by 400.

#### Diagram Explanation:

This table is a straightforward representation of the Gregorian calendar months and the corresponding number of days in each month. It is organized in such a way that each row represents a specific month (from January to December), and the column directly under each month shows the total number of days in that particular month.
Transcribed Image Text:### Number of Days in Each Month This chart provides a detailed overview of the number of days in each month. | Month | 1 Jan | 2 Feb | 3 Mar | 4 Apr | 5 May | 6 Jun | 7 Jul | 8 Aug | 9 Sep | 10 Oct | 11 Nov | 12 Dec | |--------|-------|-------|-------|-------|-------|-------|-------|-------|-------|--------|--------|--------| | Days | 31 | 28 | 31 | 30 | 31 | 30 | 31 | 31 | 30 | 31 | 30 | 31 | - **January:** 31 days - **February:** 28 days (29 days in a leap year) - **March:** 31 days - **April:** 30 days - **May:** 31 days - **June:** 30 days - **July:** 31 days - **August:** 31 days - **September:** 30 days - **October:** 31 days - **November:** 30 days - **December:** 31 days **Note:** February typically has 28 days; however, it has 29 days during a leap year. Leap years occur every four years and can be determined if the year is divisible by 4, except for end-of-century years, which must be divisible by 400. #### Diagram Explanation: This table is a straightforward representation of the Gregorian calendar months and the corresponding number of days in each month. It is organized in such a way that each row represents a specific month (from January to December), and the column directly under each month shows the total number of days in that particular month.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education