creditaccount.java
来自「this a bank account with bankAccount and」· Java 代码 · 共 33 行
JAVA
33 行
//********************************************************
// 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 + =
减小字号Ctrl + -
显示快捷键?