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

  Demonstrate your knowledge in a pragmatic way

Summarize everything that we have addressed in the XML Applications course, and provide a mechanism to demonstrate your knowledge in a pragmatic way.

  Solving programming problems

Write a computer program that will figure out the total of an order when given the amount of the order ($1000) and a sales tax rate of eight percent.

  Create java applet to input miles driven and gallons used

Create the Java applet which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display miles per gallon obtained for each tankful.

  If there are 4 command line arguments

If there are 4 command line arguments (a b c filename.dat) then the engine should take a,b,c and store the resulting x1 and x2 in filename.dat working in silent mode (no use of screen)

  Write a java program that uses a search tree of strings

Write a Java program that uses a search tree of strings to sort text lines in alphabetic order. You may choose how you de?ne alphabetic order as long as there is some sense in the de?nition. You may also choose what kind of tree you use.

  Explain calculating average asdouble

EnhancedTestScoreApp.javacompiles, Uses += onscoreCountandscoreTotalfields, UsesMathclass methods to track minimum and maximum scores, Displays minimum and maximum scores at end, ChangedscoreTotaltoint, CastscoreCountandscoreTotaltodoublebefore calcu..

  Create the class airplane

Your missions is to create the class Airplane. Each Airplane object should store the following information (fields):

  Using netbeans, use repetition to display a table of values

Using Netbeans, use repetition to display a table of values showing x, the square of x and the cube of x. X is to go up to 5.

  Why the java is called platform independent

Why the Java is called platform independent? Discuss.

  Write a java program using the java graphics

Your task for this assignment is to write a Java program using the Java Graphics class to create an example of a computer generated image. This is an opportunity for you to explore computer graphics and exercise some individual creativity.

  Write down an applet which displays a 4x4 grid when the

write an applet that displays a 4x4 grid. when the user clicks on a square in the grid the applet should draw a filled

  Program with backtracking removing all gotos

Please fix the below program with backtracking removing all gotos  and also run the program before posting it and please comment before each line or explain such as what this line means or does .

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