Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that reads a month and a year and find how many days are in a given month. Check if the

 






Write a Java program that reads a month and a year and find how many days are in a given month. Check if the year is a leap year. The following will help in defining the solution: Every year divisible by 4 is a leap year with 29 days in February. (use if-else) Use number from 1 to 12 (i.e., 1: January, 2: February, 3: March, etc) to indicate a given month. (Use switch) Use 4 digits to indicate a year (i.e., 2005, 1996). Here are two samples of input/output: Sample input-output (1): Enter a Month: 91 Enter a Year: 2005 2005 is not a leap year and September has 30 days Sample input-output (2): Enter a Month: 2 Enter a Year: 2008 2008 is a leap year and February has 29 days

Step by Step Solution

3.42 Rating (168 Votes )

There are 3 Steps involved in it

Step: 1

import javautilScanner public class MonthYearProgram public static void mainString args Scanner scanner new ScannerSystemin SystemoutprintEnter a Mont... 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

Financial Reporting and Analysis

Authors: Lawrence Revsine, Daniel Collins, Bruce Johnson, Fred Mittelstaedt, Leonard Soffer

7th edition

1259722651, 978-1259722653

More Books

Students also viewed these Accounting questions

Question

2x 8. Solve the initial value problem y' - (22) y = 0, y(0) = 3

Answered: 1 week ago

Question

Q 5 . Prove the validity of AII in figure 3 using predicate logic.

Answered: 1 week ago