Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Open the project using BlueJ and MonthTester.java file. It contains test script for testing the Month class that you will be developing in this HW
Open the project using BlueJ and MonthTester.java file. It contains test script for testing the Month class that you will be developing in this HW assignment. Please do not make any changes to the MonthTester class. There are 41 test cases. Your final code for Month class should pass all the 41 test cases. Write a class named Month Note: This class does not contain any IO (use of System.out.print, System.out.println, or Scanner object) or main method. 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 following constructors/methods 1) A no-arg constructor that sets the monthNumber field to 1 2) 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 3) A constructor 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 4) A copy constructor which accepts a Month object and copy its monthNumber to this.monthNumber 5) 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 should set monthNumber to 1 6) A getMonthNumber method that returns the value in the monthNumber field. 7) A getMonthName method that returns the name of the month. For example, if the monthNumber field contains 1, then this method should return "January" 8) An equals method that accepts 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 9) A greater Than method that accepts a Month 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 10) A lessThan method that accepts a Month object as an argument. If the calling
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started