Write a class named month

Assignment Help JAVA Programming
Reference no: EM13693223

Question: Write a class named Month. The class should have an int field named monthNumber that holds the number of the month.

For example, January would be 1, February would be 2, and so forth. In addition, provide the subsequent methods:

* A no-arg constructor that sets the monthNumber field to 1

* A constructor that accepts the number of the month as an argument. It should set the monthNumber field to the value passed as the argument. If a value less than 1 or greater than 12 is passed,the constructor should set monthNumber to 1.

* A consructor that accepts the name of the month, such as "January" or "February" as an argument . It should set the monthNumber field to the correct corresponding value.

* A setMonthNumber method that accepts an int argument, which is assigned to the monthNumber field. If a value less than 1 or greater than 12 is passed, the method shuold set monthNumber to 1.

* A getmonthNumber method that returns the value in the monthNumber field.

* A getmonthNumber method that returns the name of the month. For example, if the monthNumber field contains 1, then this method should return "January".

* A toString method that returns the same value as the getMonthName method.

* An equal's method that accept a month object as an argument. If the argument object holds the same data as the calling object, this method should return true. Otherwise, it should return false.

* A greaterThan method that accepts a Moth object as an argument. If the calling object's monthNumber field is greater than the argument's monthNumber field, this method should return true. Otherwise, it should return false.

* A lessThan method that accepts a Month object as an argument . If the calling object's monthNumber field is less than the argument's monthNumber field, this method should return true. Otherwise, it should return false.

Make this program using java programming. Make this application in simple way.

Reference no: EM13693223

Questions Cloud

Ph reading to approximate the ka for acetic acid : Problem- A .1 M NaC2H3O2 solution gave a 7.77 pH meter reading. Use the concentration and pH reading to approximate the Ka for acetic acid. Show calculations.
Explain the conventions and rules used : Problem- Please provides the formula for the listed coplex ions/compounds below. If you could explain the conventions and rules you used.
How many ml of alcohol are in the bottle of wine : Problem- a) How many mL of a 45.0% (m/v) solution of NaCl would you need in order to have 12.0 g of NaCl. b) A bottle of wine contains 750.0 mL of wine. If the wine is 12.00% (v/v) alcohol, how many mL of alcohol are in the bottle of wine
What volume is milliliters of sodium hydroxide solution : Problem- What volume is milliliters of 9.950 x 10-2M sodium hydroxide solution is required to reach the equivalence point in the complete titration of a 17.0mL sample of 0.114M phosphoric acid
Write a class named month : Write a class named Month. The class should have an int field named monthNumber that holds the number of the month.
The highest temperature at which vaporization will occur : Problem- A liquid mixture of 20 mol% benzen,50 mol% toluene, and 30%m-xylene is to be partially vaporized at 1 atm pressure. What is the lowest and the highest temperature at which vaporization will occur
Write the function - void shuffle : Write the function: void shuffle(int ar[], int size); This function "shuffles" the elements in the array pointed by 'ar' (and whose length is 'size').
Write a net ionic equation that accounts for the ph : Problem- A .10 M solution of socium cyanide gives a pH reading of 11.1. Write a net ionic equation that accounts for this pH and calculate the approximate concentrations of CN-, HCN, and OH- in the solution and the value of Ka for HCN.
Determine the potential energy due to the long-range : Problem- Determine the potential energy (eV) due to the long-range dipole-dipole interaction for two polar molecules with dipole moments of 1.0 D at room temperature with an internuclear separation of 500 pm. Contrast this energy with the energy o..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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