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

  Reverse the array, and find the largest element

find the max block of an array by splitting it into three parts: left, middle, right. And then reverse the array, and find the largest element.

  Write java program to print strings given at command line

Write a program Average.java which just prints strings that it is given at command line, one per line. If nothing is given at command line, print "No arguments".

  Implement a card game in java

In this assignment, you will be asked to implement a card game. You will need to make several design decisions for your code. It will be expected that all classes you write will utilize the principle of encapsulation.

  Prompt the user for an int between an upper and lower

prompt the user for an int between an upper and lower boundary. reuse the validateinput method from project to validate

  Implement a fishlake simulation similar to the previous

implement a fishlake simulation similar to the previous assignment. you will then make adjustments to accommodate class

  Difference between the two following statements

What exactly is the difference between the two following statements and which is preferred, please provide details: 1) frame.setSize(400, 300); // Set JFrame Size

  Construct 4 instances of your instrument

Create a Java test class that simulates using your MusicalInstrument class.  In your test class you should at a minimum construct 4 instances of your instrument,

  Writing a program to have it generate random words

How would I go about writing a program to have it generate random words with a letter missing for a child to guess? Maybe it would have three letters, then four, next five, and so on until maybe 10 letters. Please keep in mind that I'd like it to wor..

  Create an application for an animal-fur trimming service

create an application for an animal-fur trimming service. the business is open 15 weeks of the year from april through

  Demonstrate knowledge of design patterns

Your software should make use of the concepts outlined at the start of the assignment brief above. Think about where you can employ appropriate design patterns and other techniques.

  Improve the efficiency of their operations

To help improve the efficiency of their operations, the Maitre De has hired you to write a program that simulates people waiting for tables. The goal is to determine the average amount of time people spend waiting for tables.

  Write a java program to compute salary

Write a Java program which computes the Salary for a given number of employees. The program prompts user to enter n the number of employees.

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