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

📄 creditaccount.java

📁 银行的一个管理系统
💻 JAVA
字号:
package com.shunshi.bam.entity.model;

import com.shunshi.bam.exception.BalanceNotEnoughException;
import com.shunshi.bam.exception.BalanceSmalerZeroException;

public class CreditAccount extends Account {
	private double celling;
	
	public double getCelling() {
		return celling;
	}
	public void setCelling(double celling) {
		this.celling = celling;
	}
	public CreditAccount(){
		super();
	}
	public CreditAccount(String password,String name,String personId,String email){
		super(password,name,personId,email);
	}
	@Override
	public void withdraw(double money) throws BalanceSmalerZeroException,BalanceNotEnoughException{
		if(money<0)throw new BalanceSmalerZeroException("取钱金额不能是负数");
		if(this.getBalance()+celling<money){
			throw new BalanceNotEnoughException("对不起,你的余额不足!");
			//System.out.println("对不起,你的透支额度不足!");
			//return this.getBalance();
		}
		this.setBalance(this.getBalance()-money);
		//return this.getBalance();
	}
	public String toString(){
		return super.toString()+",celling="+celling;
	}
	public boolean equals(Object o){
		if(o==this)return true;
		boolean flag=super.equals(o);
		if(!flag){
			return false;
		}else{
			CreditAccount ca=(CreditAccount)o;
			if(ca.getCelling()==this.getCelling()){
				return true;
			}else{
				return false;
			}
		}
	}
}

⌨️ 快捷键说明

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