Write a Java program that reads a month and a year and find how many days...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Answer rating: 100% (QA)
import javautilScanner public class MonthYearProgram public static void mainString args Scanner scanner new ScannerSystemin SystemoutprintEnter a Mont... View the full answer
Related Book For
Financial Reporting and Analysis
ISBN: 978-1259722653
7th edition
Authors: Lawrence Revsine, Daniel Collins, Bruce Johnson, Fred Mittelstaedt, Leonard Soffer
Posted Date:
Students also viewed these accounting questions
-
2x 8. Solve the initial value problem y' - (22) y = 0, y(0) = 3
-
On January 1, when the market rate of interest was 5% for similar bonds, a company issued a $15,000,000, 5%, 10-year bond that pays semiannual interest on June 30 and December 31, receiving cash of...
-
For a bond when the market rate of interest is greater than the face rate of interest: (a) Describe the cash outflows shown on the budgeted cash flow statement over the life of the note. (b) Describe...
-
Investment Portfolio and Risk diversification. Analyze the situations that arise in each of the problems and calculate the value or values ?? required for each of these. Problem 2: List and discuss...
-
How would you measure the strength of a monopsonist in an input market? Would a monopsony necessarily be very profitable? What would you need to add to Figure 13.5 in order to show a monopsonist's...
-
At an amusement park there are 200-kg bumper cars A, B, and C that have riders with masses of 40 kg, 60 kg, and 35 kg respectively. Car A is moving to the right with a velocity vA = 2m/s and car C...
-
Larry Riley formed a rental agreement for a self-storage unit with Iron Gate Self Storage in December 2003. The agreement stated that a maximum of \($5,000\) of personal property could be stored in...
-
Kid Stuff Inc. is in the business of developing, promoting, and selling childrens videos. The company developed a new DVD video, called Jake the Sleepy Old dog, on January 1, 2012. For the first six...
-
1. Satisfaction A recent Gallup Poll asked a random 206 sample of 1025 adults, "In general, are you satisfied or dissatisfied with the way things are going in the United States at this time?" In all,...
-
For the partially submerged backfill in Problem 13.13 (Figure 13.37), determine the Rankine's passive force per unit length of the wall and the location of the resultant In problem 13 Problem HH Y1 ...
-
Machine Learning do using python on jupyter notebook 1. Linear Regression Dataset used: Diabetes from sklearn You are asked to solve a regression problem in the Diabetes dataset. Please review the...
-
4. Explain the financial activities which come in the ambit of Merchant Banking? What is the code of conduct laid down by SEBI, which the merchant bankers have to abide by?
-
The maximum wind velocity in a tornado at a given city follows a lognormal distribution with a mean of 90 mph and a standard deviation of 18 mph. a) What is the probability that the maximum wind...
-
Tygrim Farms, Inc, the biggest producer of chicken wings in the area wants to expand by building up to two new chicken farms. They are considering four locations: San Jose, Phoenix, Chicago and...
-
What is merchantability? What is an example of merchantability?
-
Compare the costs per unit of Job Order 410 and 411. Explain why the cost per unit under the traditional costing system is different from the cost per unit under ABC method.
-
Franz purchases a $20,000 Municipal Government Bond (Municipal Bond-issued by local governments to fund special projects) $20,000 is the face value or principal of this 10-year government bond This...
-
Which of the ocean zones shown would be home to each of the following organisms: lobster, coral, mussel, porpoise, and dragonfish? For those organisms you identify as living in the pelagic...
-
Presented below are excerpts from the 2012 annual report of Marstons PLC, a UK-based company that operates pubs. Property, plant and equipment ¢ Freehold and leasehold properties are initially...
-
Mozart Inc.'s $98,000 taxable income for 2017 will be taxed at the 35% corporate tax rate. For tax purposes, its depreciation expense exceeded the depreciation used for financial reporting purposes...
-
East Company leased a new machine from North Company on May 1, 2017, under a lease with the following information: Lease...
-
An ideal, isothermal, reversible fuel cell with reactants of oxygen and hydrogen, and a product of water operates at a temperature of \(400 \mathrm{~K}\) and a pressure of 1 bar. If the operating...
-
An electric cell has the following chemical reaction \[\mathrm{Zn}(\mathrm{s})+2 \mathrm{AgCl}(\mathrm{s})=\mathrm{ZnCl}_{2}+2 \mathrm{Ag}(\mathrm{s})\] and produces an emf of \(1.005 \mathrm{~V}\)...
-
A hydrogen-oxygen fuel cell is required to produce a constant voltage and operate over a pressure range of \(0.125-10\) bars. The datum voltage is \(1.16 \mathrm{~V}\) at a temperature of \(350...
Study smarter with the SolutionInn App