You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found this a very confusing exercise. The text gave no clear assignment and stated there were no tests.
The only way I figured out what to do was by submitting the material to the server and receiving (incorrect) test feedback.
Here are test 3, 4 and 5:
test 3:
Two persons with a same name but a different birthday should be the same. Try:
Person first = new Person("Leevi", new SimpleDate(1, 1, 2017), 70, 10);
Person second = new Person("Leevi", new SimpleDate(2, 1, 2017), 70, 10);
System.out.println(first.equals(second));
test4:
Two persons with a same name but different month of birth should not be the same. Try:
Person first = new Person("Leevi", new SimpleDate(1, 1, 2017), 70, 10);
Person second = new Person("Leevi", new SimpleDate(1, 2, 2017), 70, 10);
System.out.println(first.equals(second));
test5:
Two persons with same name but different year of birth should not be the same. Try:
Person first = new Person("Leevi", new SimpleDate(1, 1, 2017), 70, 10);
Person second = new Person("Leevi", new SimpleDate(1, 1, 2018), 70, 10);
System.out.println(first.equals(second));
In fact, test 3 only passes if day is not the same:
//past test 4
if (nameFlag && monthFlag && yearFlag && heightFlag && weightFlag && dayFlag) {
//Two persons with a same name but a different birthday should be the same.
return true;
} if (nameFlag && monthFlag && yearFlag && heightFlag && weightFlag) {
//pass test 3
return false;
}
else {
return false;
}
forgive the awkward code ;)
The text was updated successfully, but these errors were encountered:
I found this a very confusing exercise. The text gave no clear assignment and stated there were no tests.
The only way I figured out what to do was by submitting the material to the server and receiving (incorrect) test feedback.
Here are test 3, 4 and 5:
test 3:
Two persons with a same name but a different birthday should be the same. Try:
Person first = new Person("Leevi", new SimpleDate(1, 1, 2017), 70, 10);
Person second = new Person("Leevi", new SimpleDate(2, 1, 2017), 70, 10);
System.out.println(first.equals(second));
test4:
Two persons with a same name but different month of birth should not be the same. Try:
Person first = new Person("Leevi", new SimpleDate(1, 1, 2017), 70, 10);
Person second = new Person("Leevi", new SimpleDate(1, 2, 2017), 70, 10);
System.out.println(first.equals(second));
test5:
Two persons with same name but different year of birth should not be the same. Try:
Person first = new Person("Leevi", new SimpleDate(1, 1, 2017), 70, 10);
Person second = new Person("Leevi", new SimpleDate(1, 1, 2018), 70, 10);
System.out.println(first.equals(second));
In fact, test 3 only passes if day is not the same:
forgive the awkward code ;)
The text was updated successfully, but these errors were encountered: