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

📄 creditaccount.java

📁 一个ATM银行模拟系统
💻 JAVA
字号:
package model;

import exception.BalanceNotEnoughException;

public class CreditAccount extends Account {
	private double ceiling;
	
	public double getCeiling() {
		return ceiling;
	}

	public void setCeiling(double ceiling) {
		this.ceiling = ceiling;
	}

	public CreditAccount() {
		super();
	}

	public CreditAccount(String password, String name, String personId, String email) {
		super(password, name, personId, email);
	}

	public void withdraw(double money) throws BalanceNotEnoughException {
		if (getBalance()+ceiling<money) {
			throw new BalanceNotEnoughException("您的透支额度不足");
		}
		else{
			this.setBalance(this.getBalance()-money);
		}
	}
	
	public boolean equals(Object o){
		if (this==o) return true;
		boolean flag=super.equals(o);
		if (!flag) return false;
		CreditAccount ca=(CreditAccount)o;
		if (this.ceiling==ca.ceiling) return true;
		else return false;
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -