Question
Create a Java class called DaysInAMonth that takes in a month and year as input and displays the number of days in that month. You
Create a Java class called DaysInAMonth that takes in a month and year as input and displays the number of days in that month. You must include the logic to check for a leap year.
A leap year is divisible by 4 and for years that end in 00 (century years).it should be divisible by 400. Remember not all century years are leap years. 1900 was not a leap year.
For example:
Enter year: 2020
Enter month (1 - 12): 2
You've chosen February, 2020 and it has 29 days.
Enter year: 2021
Enter month (1 - 12): 4
You've chosen April, 2021 and it has 30 days.
1. In your source files, you must provide comments at the top of the source file
- Javadoc style comments must be the first few lines in your file after a package import
2.Formatyour source file so that it's properly indented.
3. Since you will be using Scanner, make sure you close the scanner at the end of the main method by calling on theclose() method.
4. Check your code for syntax and logical errors
5. Name your classes, variables appropriately.
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 StartedRecommended Textbook for
Microsoft Visual C# An Introduction to Object-Oriented Programming
Authors: Joyce Farrell
7th edition
978-1337102100
Students also viewed these Programming questions
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
Question
Answered: 1 week ago
View Answer in SolutionInn App