Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

part05-part05_13.IdenticalTwins #432

Open
Luitenist opened this issue Aug 24, 2023 · 0 comments
Open

part05-part05_13.IdenticalTwins #432

Luitenist opened this issue Aug 24, 2023 · 0 comments

Comments

@Luitenist
Copy link

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 ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant