Please written by computer source JAVA. This is my third time reposting this question. I need DATETEST class written to fit my ALREADY WRITTEN date.java. thank you! Write DateTest class which includes the main method. The program should create three objects of the Date class and one of them should use the default constructor and the other two use three-parameter constructor. Print all three dates using toString method. Change the month, day, and year of one of the dates using set methods, and then use get methods to display the new value of month, day, and year. Print all three dates again using printDate method. (please include comments) Here is my "date.java" I just need you to help with the test class package class Date { // month, day, and year as private instance variables. private int month; private int day; private int year; //default constructor public Date() { // set the date to 1/1/2000 this.month = 1; this.day = 1; this.year = 2000; } // three-parameter constructor will include a given month, day, and year as parameters. public Date(int month, int day, int year) { this.month = month; this.day = day; this.year = year; } // get month public int getMonth() { return month; } // set month public void setMonth(int month) { this.month = month; } // get day public int getDay() { return day; } // set day public void setDay(int day) { this.day = day; } // get year public int getYear() { return year; } // set year public void setYear(int year) { this.year = year; } //toString method to return the date in “month/day/year” format as a string. @Override public String toString() { return month + "/" + day + "/" + year; } //printDate method to print the date in month/day/year format. public void printDate(){ System.out.println(month + "/" + day + "/" + year); } }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter7: Using Methods
Section: Chapter Questions
Problem 1CP
icon
Related questions
Question

Please written by computer source

JAVA. This is my third time reposting this question. I need DATETEST class written to fit my ALREADY WRITTEN date.java. thank you!

Write DateTest class which includes the main method. The program should create three objects of the Date class and one of them should use the default constructor and the other two use three-parameter constructor. Print all three dates using toString method. Change the month, day, and year of one of the dates using set methods, and then use get methods to display the new value of month, day, and year. Print all three dates again using printDate method. (please include comments)


Here is my "date.java" I just need you to help with the test class package

class Date {

// month, day, and year as private instance variables.

private int month;

private int day;

private int year;

//default constructor

public Date() {

// set the date to 1/1/2000

this.month = 1;

this.day = 1;

this.year = 2000;

}

// three-parameter constructor will include a given month, day, and year as parameters.

public Date(int month, int day, int year) {

this.month = month;

this.day = day;

this.year = year;

}

// get month

public int getMonth() {

return month;

}

// set month

public void setMonth(int month) {

this.month = month;

}

// get day

public int getDay() {

return day;

}

// set day

public void setDay(int day) {

this.day = day;

}

// get year

public int getYear() {

return year;

}

// set year

public void setYear(int year) {

this.year = year;

}

//toString method to return the date in “month/day/year” format as a string.

@Override

public String toString() {

return month + "/" + day + "/" + year;

}

//printDate method to print the date in month/day/year format.

public void printDate(){

System.out.println(month + "/" + day + "/" + year);

}

}

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
void method
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning