loancreditaccount.java
来自「电子银行系统」· Java 代码 · 共 52 行
JAVA
52 行
package model;import Exception.*;public class LoanCreditAccount extends CreditAccount implements Loannable { private double loanmoney = 0; public LoanCreditAccount(String password, String name, String personId, String email) { super(password, name, personId, email); } public void requestLoan(double money) { this.loanmoney += money; } public void payLoan(double money) throws BusinessException.LoanException, BusinessException.BalanceNotEnoughException { if (this.loanmoney - money >= 0) { // this.setBalance(this.getBalance()+money); this.withdraw(money); this.loanmoney -= money; } else throw new BusinessException.LoanException( "LoanException-->LoanCreditAccount 您不需要还这么多贷款 ! "); } public double getLoan() { return this.loanmoney; } /* * public String toString() { return * this.getName()+"\t"+this.getPersonId()+"\t"+this.getEmail(); } */ public boolean equals(Object o) { boolean flag = super.equals(o); if (!flag) return false; Loannable c = (Loannable) o; if (this.loanmoney != c.getLoan()) return false; else return true; } public int hashCode() { // TODO Auto-generated method stub return super.hashCode()^new Double(loanmoney).hashCode(); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?