Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I don't understand how to compare one date with another one and how to write codes in java, the first picture is the purpose and
I don't understand how to compare one date with another one and how to write codes in java, the first picture is the purpose and the second one is the codes in a Tester file
PS: There are many tasks in the assignment I don't know how to do, but there is no way to upload files on Chegg, so I wonder is there any methods that I could get the codes of what I need
Thanks in advance
/* equals * Purpose: determines whether the month, day and year of * this instance of Date is equal to other's month, day, year * * Parameters: Date other * * Precondition: other is not null and is a valid Gregorian date * * Returns: true if this Date equals other date, false otherwise * | TODO... public static void dateEqualsTests() { // TODO: // uncomment the following to test your implementation Date d = new Date("January", 15, 2018); Date dEqual = new Date("January", 15, 2018); Date derDiff = new Date("January", 15, 2019); Date dmthDiff = new Date("February", 15, 2018); Date dDayDiff = new Date("January", 10, 2018) Date dDefault = new Date(); displayResults (d.equals(d), "Date Equals Tests - same object"); displayResults (d.equals(dEqual), "Date Equals Tests - different objects, equal date"); displayResults (dEqual.equals(d), "Date Equals Tests - different objects, equal date"); displayResults (d.equals(dyrDiff) == false, "Date Equals Tests - different objects, years differ"); displayResults (!dMthDiff.equals(d), "Date Equals Tests - different objects, months differ"); displayResults (!d.equals(dDayDiff), "Date Equals Tests - different objects, days differ"); displayResults (!dDefault.equals(dDayDiff), "Date Equals Tests - different objects, all fields differ")Step 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