📄 checkingaccount.java
字号:
package Accounts;
import People.Customer;
import dslib.base.FormatUos;
/** A checking account allows an overdraft up to the line of credit of the account. */
public class CheckingAccount extends RegularAccount
{
/** The line of credit for the account. */
protected float lineOfCredit;
public CheckingAccount(Customer c, int n)
{
super(c, n);
}
/** Change the line of credit for the account. */
public void setLoc(float amount)
{
lineOfCredit = amount;
}
/** The line of credit for the account. */
public float lineOfCredit()
{
return lineOfCredit;
}
/** Account information for the monthly statement. */
public String generateMonthlyStmt()
{
return super.generateMonthlyStmt() + "The line of credit is $"
+ FormatUos.withDecimals(lineOfCredit, 2) + "\n";
}
/** String representation of the account. */
public String toString()
{
return "Checking account " + number + ": Owner " + owner.name()
+ "\n" + FormatUos.pad("", 11, 'l') + "Balance "
+ FormatUos.withDecimals(balance, 2)
+ "\n" + FormatUos.pad("", 11, 'l') + "Line of credit "
+ FormatUos.withDecimals(lineOfCredit, 2) + "\n";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -