Question: java uml to code Module 3 Month.java Project Topics: Classes and Objects, UML diagram, equals method Implement a class named Month. The class should have

 java uml to code Module 3 Month.java Project Topics: Classes and

Objects, UML diagram, equals method Implement a class named Month. The class

java uml to code

should have an int field named monthNumber that holds the number of

the month. For example, January would be 1, February would be 2,

Module 3 Month.java Project Topics: Classes and Objects, UML diagram, equals method Implement 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 following methods as shown in the following UML document. If you have any questions, please ask. Month -month Number: int // stores the number of the month from 1 - 12 + Month /o-arg constructor. Initialize instance variable month to 1 + Month(m:int) //Initialize instance variable month Number to m + Month (monthName: String) //Initialize monthNumber according to the month Name +getMonthName (): String //returns the name of the month as String +get Month Number(): int //returns the number of the month as int +set Month Number (m: int) : void //sets month Number to m if a valid month number +greaterThan( month2 : Month): boolean // returns true if calling object's month is greater than month2 +lessThan( month2 : Month): boolean // returns true if the calling object's month is less than month2 +equals (month2: Month): boolean // If the argument object month2 holds the same data as the calling // object, this method should return true. Otherwise, it should return false. + toString(): String //displays the String rep. of the object. It returns the String name of the month // and not the monthNumber. +set Month Number (m: int) : void //sets month Number to m if a valid month number +greaterThan( month 2 : Month): boolean // returns true if calling object's month is greater than month +lessThan( month2 : Month): boolean // returns true if the calling object's month is less than month2 +equals (month2: Month): boolean // If the argument object month2 holds the same data as the calling // object, this method should return true. Otherwise, it should return false. + toString(): String //displays the String rep. of the object. It returns the String name of the month // and not the month Number Your code should work with the driver class provided (Month Tester.java). Use the driver with no code modifications. Your output must look exactly as given below. /* Output Month 1 is January Month 1 is January Month 1 is January Month 2 is February Month 3 is March Month 4 is April Month 5 is May Month 6 is June Month 7 is July Month 8 is August Month 9 is September Month 10 is October Month 11 is November @auther Dilshad Haleem and Java Foundations Date written: August 2019 * Breif Description: * This program demonstrates a solution to the Month Class programming * project. This is the driver/tester application. */ public class Month Driver { public static void main(String[] args) { Month m, mi, m2, m3, m4, m5; // Use the no-arg constructor. m = new Month(); System.out.println("Month " + m.getMonthNumber() + " is " + m); // Set the month number to the values 0 through 12 // (0 is invalid), and display the resulting month name. for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!