Create a java class called month

Assignment Help JAVA Programming
Reference no: EM13760343

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) - Extra Credit 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.

Reference no: EM13760343

Questions Cloud

Rewrite programming to create a gui : Rewrite Programming Exercise to create a GUI. Your probram should let the user eanter the loan amound and loan period in the the number of years from the tests fields and it should sisplay the monthly and total payments for each interest rate start..
Identify issues that your organization should address : When you evaluate your organization's outputs at the organizational, group, and individual levels, do you see anything that might identify issues that your organization should address?
Method of reporting cash flows from operating activities : On the basis of the following data for Teller Co. for 2006 and the preceding year ended December 31, 2005, prepare a statement of cash flows in excel. Use the indirect method of reporting cash flows from operating activities.
Medical sociolog : Health plays a major role in the functioning of society.
Create a java class called month : Create a program/project called [YourName]-(replace [YourName] with your actual name) in the same project as the Month.java, Create three objects: Month1 one using the first constructor (with no arguments) and Month2 using the second constructor wi..
Accounting principles-comprehensive : Presented below are a number of business transactions that occurred during the current year for Gonzales, Inc. Instructions In each of the situations, discuss the appropriateness of the journal entries in terms of generally accepted accounting pri..
Traditional methods of distribution : Today, companies must decide whether to sell their products directly to their customers via the Internet or to use more traditional methods of distribution.
Analyzing an organization using nadler and tushmans model : Is the strategy in line with organization's environmental inputs? Are the transformation process (the key tasks, the formal organization, the informal organization, and the key individuals) all aligned well with your organization's strategy? How d..
Compute the exponential smoothing forecast : Construct a time series plot. What type of pattern exists in the data and show the four-quarter and centered moving average values for this time series.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Determine the purpose of using javascriptreg on a website

what is the purpose of using javascriptreg on a website? what is a specific example of a javascriptreg application that

  1 introductionin order to debug an application it is

1 introductionin order to debug an application it is sometimes useful to know where a given object comes from or where

  The objective is to implement a menu-based system

The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

  Write a program that simulate n rolls of six-sided die

Write a program that simulate n rolls of six-sided die and displays the frequency of occurrence of each side and What is the most likely method signature of the "parseInt() - TNE60003

  Strong authentication can also risk availability

Strong authentication can also risk availability. A simple example is that forgetting your password denies you access to that which required a password. Sometimes the stakes are high, for example, if a network administrator is the only one who knows ..

  Program that takes the amount a person has spent

Program that takes the amount a person has spent and determines the discount ($15 per $175 spent).

  Write a function which takes two string variables

Write a function which takes two string variables not C strings as inputs and compares them. If they are equal, the function should return 0. If the first-string is less than the second string, return a negative number. If the first string is grea..

  Represent one book in java

Represent one book in java

  Develop java applet that will help elementary school student

Develop a Java applet that will help an elementary school student learn multiplication. Use the Math.random method or a Random object to produce two positive one-digit integers.

  Point of sale terminal

a software implementation of a Point of Sale terminal at a typical store. The users of the system are the cashiers sitting at the sales terminals of the store. The users can use the system to manage sales items in the store, customer details and of c..

  Your task is to design and implement a sorting

your task is to design and implement a sorting algorithmalgorithm that can sort nonnegative integers that fall within

  Class sorter which contains methods for selection sort

Write a class Sorter which contains methods for selection sort, insertion sort and bubble sort (start with the code below). Then create a client class which asks user to enter ten numbers using arrays. Then the program asks user which sorting algo..

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