📄 creditaccount.java
字号:
//********************************************************
// CreditAccount.java Author:ZhaoHaiyan
//
// deposit and withdraw money from creditAccount
//********************************************************
public class CreditAccount extends BankAccount
{
final int limit=-1000; // credit limit
public CreditAccount(int initialDeposit) //constructor
{
super();
setBalance(initialDeposit);
}
public boolean withdraw(int amount)
{
if(amount<=getBalance()-limit) //judge if it is beyond the limit
{
setBalance(getBalance()-amount);
return true;
}
else
{
System.out.println("beyond the limit!");
return false;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -