Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here's the code I have currently but when I test it I get the same date for hiredDate and birthDate The Person Class public class
Here's the code I have currently but when I test it I get the same date for hiredDate and birthDate
The Person Class public class Person { private String lastName; private String first Name; private Date birthDate; public Person (String lastName, String first Name, Date birthDate) ! this.lastName = lastName; this.firstName = firstName; this.birthDate = birthDate; public String getLastName() { return lastName; } public String get FirstName() { return firstName; public Date getBirthDate() { return birthDate; } public void setLastName (String lastName) { this.lastName = lastName; } public void setFirst Name (String firstName) { this.firstName = firstName; } public void setBirthDate (Date birthDate) { this.birthDate = birthDate; } The Date Class public class Date { private int year; private int month; private int day; // 1-12 // 1-31 public Date(int year, int month, int day) { this.year = year; this.month = month; this.day = day; } public Date() { GregorianCalendar today = new GregorianCalendar(); year = today.get (Calendar. YEAR); month = today.get (Calendar.MONTH) + 1; day = today.get (Calendar.DATE); } public String toString() { return year + "-" + make TwoDigits (month) + makeTwoDigits (day); "-" + public boolean equals (Date otherDate) { return ((this.year == other Date.year) && (this.month == otherDate.month) && (this.day == otherDate.day) ); } .; private static String makeTwoDigits (int n) { if (nStep 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