Write a driver class

Assignment Help JAVA Programming
Reference no: EM131604459

Write a class named DaysOfMonth.java. The class's constructor should accept two arguments:
- An integer for the month (1 = January, 2 February, etc).
- An integer for the year

The class should have a method named getNumberOfDays that returns the number of days in the specified month. The method should use the following criteria to identify leap years:

1. Determine whether the year is divisible by 100. If it is, then it is a leap year if and if only it is divisible by 400. For example, 2000 is a leap year but 2100 is not.

2. If the year is not divisible by 100, then it is a leap year if and if only it is divisible by 4.

For example, 2008 is a leap year but 2009 is not.

Write a driver class called DaysOfMonthDemo.java. This program asks the user to enter the month (letting the user enter an integer in the range of 1 through 12) and the year. The program should then display the number of days in that month. Here is a sample run of the program:

Enter a month (1-12): 2 [Enter] Enter a year: 2008 [Enter]
Expected Output
Number of days in February, 2008: 29 days

Reference no: EM131604459

Questions Cloud

How many of each item should be ordered : Perform an operation to determine how many of each item should be ordered to maintain the stock - The program must use a pop-up dialogue box to get
What problems do experts encounter trying : what problems do experts encounter trying to ascertain if the sex was not consensual
Find the minimum cost to produce one thousand items : With quantities x and y of two raw materials available, Q = x½y½ thousand items can be produced at a cost of C = 2x + y thousand dollars.
The palliative care research : The ACS funded the Palliative Care Research (American Cancer Society, 2017b). According to this study, the original goals of palliative care.
Write a driver class : Determine whether the year is divisible by 100. If it is, then it is a leap year if and if only it is divisible by 400. For example, 2000 is a leap year but 210
How can you easily identify ipv-six multicast addresses : How can you easily identify IPv6 multicast addresses? Provide a good example. What commands are used to apply initial router configurations?
The expected returns of each of the four individual assets : What are the expected returns of each of the four individual assets and the three portfolios if the current SML is plotted with an intercept of 3.0?% ?
Find the marginal rate of increase of the number of bees : An agricultural worker in Uganda is planting clover to increase the number of bees making their home in the region. There are 100 bees in the region naturally.
Explain the ancient civilizations of mesopotamia : How is the Mesoamerica and Andean South America civilizations are compared, how are they similar to the ancient civilizations of Mesopotamia

Reviews

Write a Review

JAVA Programming Questions & Answers

  Display a welcome message to your user

Write a one screen description of your initial reactions to Java. Reactions may be both positive and negative. At the end of this module you will be asked to write a reply to these initial reactions.

  Explain role of java developer in implement java application

Explain Role of Java Developer in Implementing Java Web Application. Methodology is a research paper about Action Research and 7-9 pages.

  Evaluate an infix expression entered by the user

Spaces between tokens are allowed but not required. The program will repeatedly prompt the user for the value of x, displaying the value of the expression each time. When the user enters the letter q instead of a number, the program terminates.

  Write a program that tests the users ability

CS 1400 - Hilton - Write a program that tests the users ability to memorize a random sequence of colors - you are required to write elegant code

  Swing gui program to make the applet

Each button under Yes or No, when clicked, would respond with a corresponding statement printed in the South border to say

  Uml exercise automated teller machine atmnbspbrief

uml exercise automated teller machine atmnbspbrief statement of purposean atm is an electronic device designed for

  Does class implement the interface

Does class implement the interface - public class Junk implements Nonsense - public booloan giveBoolean

  Project amount of total sales

Write a program called sales_prediction.js, that displays the profit based on the project amount of total sales for the year. Use a literal value of $2,500,000 for the projected total sales amount. Display the profit amount formatted to two decima..

  Draw the result of taking the tree in the diagram

Draw the result of taking the tree in the diagram and deleting the root three times using the deletion algorithm from lecture and the web

  In light of wrestling with ethics

In light of "Wrestling With Ethics" and other research/articles that you are able to draw upon, should profitability drive social responsibility? Be sure to support your discussion question responses with evidence from the readings and/or additional ..

  Write a java gui application using a netbeans ide

Write a Java GUI application using a NetBeans IDE that does home utility auditing. The user should be able to do the Enter the cost per kilowatt-hour.

  Implement program that prompts for number of students

A group of students have been told to get into teams of a specific size for their class work. Design and implement a program that prompts for the number of students in the group and the size of the teams to be formed, and display how many teams ca..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd