我需要帮助来覆盖该equals方法.除了这个equals方法,我的一切都在工作.equals我目前拥有的方法并没有给我正确的答案.我似乎无法弄清楚可能是什么问题.
我的课:
package myclasses;
public class Currency
{
private int dollars, cents;
public Currency()
{
dollars = 0;
cents = 0;
}
public Currency(int d, int c)
{
this.dollars = d;
this.cents = c;
setCents(cents);
}
public int getDollars()
{
return dollars;
}
public int getCents()
{
return cents;
}
private void setDollars(int dollars)
{
this.dollars = dollars;
}
private void setCents(int cents)
{
while(cents > 99)
{
cents = (cents - 100);
dollars++; …Run Code Online (Sandbox Code Playgroud)