Question: Create a file named A6.java. Place all code in this file. In Java, write a class definition for Date, an object type that contains three

Create a file named A6.java. Place all code in this file.

In Java, write a class definition for Date, an object type that contains three private field integers: year, month, and day. This class should provide two constructors. The first should take no parameters and initialize a default date (12/30/2020). The second should take parameters named day, month and year, and use them to initialize the instance variables. Write getters and setters for year, month, and day (getYear, setYear, getMonth, setMonth, getDay, setDay). Implement the toString and equals methods. The toString method should output the date in American date format (e.g. year = 2020, month = 12, day = 10 should output 12/10/2020).

Hint: To add a class to a file with a different name, you can remove public from your new classs definition. For example: public class A6 { } class Date { // Dates implementation }

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!