Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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 (n

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago