@Override
public void withdraw(User user, int amount) {
if (!checkWithdraw(user,amount))
return;
user.setBalance(user.getBalance() - amount - amount*user.getBank().getCommission(amount));
}
@Override
public void fund(User user, int amount) {
if (!checkFund(user, amount))
return;
user.setBalance(user.getBalance() + amount);
}
@Override
public void transferMoney(User fromUser, User toUser, int amount) {
if (!checkWithdraw(fromUser,amount))
return;
if (!checkFund(toUser, amount))
return;
fromUser.setBalance(fromUser.getBalance()-amount-amount*fromUser.getBank().getCommission(amount));
toUser.setBalance(toUser.getBalance()+amount);
**if (fromUser.getBank().getCurrency()==toUser.getBank().getCurrency()) return;**
}
我需要检查用户之间的货币是否不同,如果是,我需要返回 null。我觉得不对,帮我看看
慕码人8056858
相关分类