Question: create a blueprint class (Month) for driver class (MonthDemo) In JAVA . must work with provided Driver class. ***********DRIVER CLASS****************** /** This program demonstrates a

create a blueprint class (Month) for driver class (MonthDemo) In JAVA. must work with provided Driver class.

***********DRIVER CLASS******************

/**

This program demonstrates a solution to the

Month Class programming challenge.

*/

public class MonthDemo

{

public static void main(String[] args)

{

// Use the no-arg constructor.

Month m = new Month();

System.out.println("Month " + m.getMonthNumber() +

" is " + m);

// Set the month number to the values 2 through 12

for (int i = 2; i <= 12; i++)

{

m.setMonthNumber(i);

System.out.println("Month " + m.getMonthNumber() +

" is " + m);

}

// Use the 2nd constructor to create two objects.

Month m1 = new Month(10);

Month m2 = new Month(5);

System.out.println("Month " + m1.getMonthNumber() +

" is " + m1);

System.out.println("Month " + m2.getMonthNumber() +

" is " + m2);

// Test for equality.

if (m1.equals(m2))

System.out.println(m1 + " and " + m2 + " are equal.");

else

System.out.println(m1 + " and " + m2 + " are NOT equal.");

// Is m1 greater than m2?

if (m1.greaterThan(m2))

System.out.println(m1 + " is greater than " + m2);

else

System.out.println(m1 + " is NOT greater than " + m2);

// Is m1 less than m2?

if (m1.lessThan(m2))

System.out.println(m1 + " is less than " + m2);

else

System.out.println(m1 + " is NOT less than " + m2);

}

}

**************OUTLINE FOR BLUEPRINT*********************

(what I have so far)

public class Month {

int monthNumber=0;

Month(){

monthNumber =1;

}

Month(int m){

monthNumber =m;

if (m<0 || m>12) {

monthNumber =1;

}

}

Month(String months){ // get input in and output name of month based on what number correspondes to that month

if (months.equals("January")){

monthNumber =1;

for (int i = 0; i <12;i++)

monthNumber = months[i];

}

}

public String getMonthName() {

return name;

}

public String toString() {

return "";

}

public boolean equals() {

return false;

}

public boolean greaterThan(String Month) {

return false;

}

}//end of program

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!