⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 loansavingaccount.java

📁 电子银行系统
💻 JAVA
字号:
package model;import Exception.*;public class LoanSavingAccount extends SavingAccount implements Loannable {	private double loanmoney = 0;	public LoanSavingAccount(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) {			// if((this.getBalance()-money)<0) throw new			// BusinessException.BalanceNotEnoughException("BalanceNotEnoughException--->SavingAccount			// 您的余额不足 ! ");			// this.setBalance(this.getBalance()+money);			System.out.println("setBalance");			this.withdraw(money);			this.loanmoney -= money;		} else			throw new BusinessException.LoanException(					"LoanException-->LoanSavingAccount 您不需要还这么多贷款 ! ");	}	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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -