📄 accountimpl.java
字号:
import java.rmi.RemoteException;
public class AccountImpl implements Account {
private BankManager bankManager;
private Client client;
private long balance;
private String accountNumber;
// public constructor
public AccountImpl (
BankManager bankManager,
Client client,
String accountNumber) {
this.bankManager = bankManager;
this.client = client;
this.balance = 0;
this.accountNumber = accountNumber;
}
public void deposit(long amount) {
balance += amount;
}
public BankManager getBankManager()
throws RemoteException {
return bankManager;
}
public Client getClient()
throws RemoteException {
return client;
}
public long getBalance()
throws RemoteException {
return balance;
}
public long getCash(long amount)
throws NoCashAvailableException, RemoteException {
if (amount > balance) {
throw new NoCashAvailableException();
}
balance = balance - amount;
return amount;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -