Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

Assignment

Create a class called Month (java file called Month.java) with the (exact) following fields and methods (these names and caps exactly):

Filed/Method Description

MonthNumber An int field that holds the number of the month

Number Name

1 January

2 February

3 March

4 April

5 May

6 June

7 July

8 August

9 September

10 October

11 November

12 December

Month A no-argument constructor that sets the monthNumber field to 1

Month A contructor that accept the number of the month as an argument (1, 2, etc) and sets the monthNumber field to that value. If a value less than 1 or larger that 12 is passed , the constructor should set monthNumber to 1 Month A contructor that accept the name of the month as an argument ("January", February", etc) and sets the monthNumber field to the corresponding number.

GetMonthNumber A method that returns the monthNumber field value

SetMonthNumber A method that accept an int number as an argument and sets the monthNumber field to that number

GetMonthName A method that returns the name of the month corresponding to the monthNumber field value

SetMonthName A method that accept a string value as an argument (representing the name of the month: "January", February", etc.) and sets the monthNumber field to the

Corresponding number (1, 2, etc) -

Equals A method that accepts a Month object as an argument and returns true if the data from that object (its MonthNumber) is the same as the MonthNumber field or false

otherwise GreaterThan A method that accepts a Month object as an argument and returns true if the data from that object (its MonthNumber) is greater than the MonthNumber field or false

otherwise

LessThan A method that accepts a Month object as an argument and returns true if the data

from that object (its MonthNumber) is less than the MonthNumber field or false

otherwise

You are going to lose points if you do not name the class, the fields, or methods as requested. You should not have a field for the month name: your code should compute the name of the month from the number when needed.

Create a program/project called [YourName]-Assignment6 (replace [YourName] with your actual name) in the same project as the Month.java. You will need to add the class Month to the project and add your code to the project class main method. The program (code) should:

Create three objects: Month1 one using the first constructor (with no arguments) and Month2 using the second constructor with 2 as an argument, and Month3 using the third constructor with "October" as an

Argument.

Use the GetMonthNumber to get the month number from objects Month1, Month2, and Month3 and output the values to the console.

Use the GetMonthName to get the month name from objects Month1, Month2, and Month3 and output the values to the console.

Use the SetMonthNumber to set the Month1 object value to 9.

Use the SetMonthName with argument "September" to set the Month2 object value to 9. - Extra Credit

Use the GetMonthName to get the month name from objects Month1, Month2, and Month3 and output the values to the console.

Use the Equals method of Month1 to compare its value with Month2 value and output the result to the console.

Use the GreaterThan method of Month2 to compare its value with Month3 value and output the result to the console.

Use the LessThan method of Month3 to compare its value with Month1 value and output the result to the console.

Java, Programming

  • Category:- Java
  • Reference No.:- M92027716
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Java

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Question slideshows or carousels are very popular in

Question : Slideshows (or carousels) are very popular in websites. They allow web developers to display news or images on the website in limited space. In this code challenge, you are required to complete the JavaScript ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

In ruby the hash class inherits from enumerable suggesting

In Ruby, the Hash class inherits from Enumerable, suggesting to a programmer that Hashes are collections. In Java, however, the Map classes are not part of the JCF (Java Collections Framework). For each language, provide ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone please help me with the following java

can someone please help me with the following java question The input is an N by N matrix of nonnegative integers. Each individual row is a decreasing sequence from left to right. Each individual column is a decreasing s ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As