调用AddBirthdayBonus
时,余额字段不会更新。任何帮助表示赞赏。
public class class
{
private float balance;
private float bob;
public class(float amount, float bob)
{
balance = amount;
}
birthdate = birthday;
}
public void AddBirthdayBonus(float todayDate)
{
if (todayDate == bob)
{
balance += 5;
}
}
答案 0 :(得分:2)
这样的事情有更多工作机会:
public class MyClass{
private float balance;
private float bob;
public MyClass(float balance, float bob)
{
this.balance = balance;
this.bob = bob;
}
public void AddBirthdayBonus(float todayDate)
{
if (todayDate == bob){
balance += 5;
}
}
}
答案 1 :(得分:0)
鲍勃在这里没有任何价值,因此您无法将其与另一个变量进行比较,您应该为其分配一个值,以便能够将其与另一个变量进行比较