This site requires JavaScript, please enable it in your browser!
Greenfoot back
Sean03
Sean03 wrote ...

2018/12/21

I need Help With An Assignment

Sean03 Sean03

2018/12/21

#
i have no idea where to start.
/**
     *  Returns true if aCoin's name is the same as this coin's name AND aCoin's value is the same as this coin's value
     */
    // public boolean equals(Coin aCoin)
    // {
        
    // }
danpost danpost

2018/12/21

#
You only need to combine the two conditions. In pseudo-code:
boolean conditionOne = << 1st condition >>;
boolean conditionTwo = << 2nd condition >>;
return conditionOne && conditionTwo;
The last line combines the two conditions and returns the result. This can also be simplified to this:
return << 1st condition >> && << 2nd condition >>;
without having to explicitly declare the boolean variables.
You need to login to post a reply.