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

📄 creditaccount.java

📁 实现银行系统的一系列功能,比如存款取款透支查询余额等
💻 JAVA
字号:
package tarena.bank.server;

import java.io.Serializable;

public class CreditAccount extends Account implements Serializable{
	public static final int ACCOUNT_TYPE=1;
	private double ceiling;

	public CreditAccount(long id, String passwd, String name, String personId,
			String email,double balance,int type) {
		super(id, passwd, name, personId, email,balance,type);
	}

	public double getCeiling() {
		return ceiling;
	}

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

	public synchronized void withdraw(double money) {

		if (money > this.getBalance() && this.getBalance() > 0
				&& (money - this.getBalance() <= ceiling)) {
			System.out.println("Your balance is ceiling now!");
			this.setBalance(this.getBalance() - money);
		} else if (this.getBalance() <= 0
				&& money <= ceiling + this.getBalance()) {
			this.setBalance(this.getBalance() - money);
		} else if (this.getBalance() <= 0
				&& money > ceiling + this.getBalance()) {
			System.out.println("Out of Ceiling!Operation Canceled!");
		} else if (this.getBalance() > 0 && money < this.getBalance()) {
			this.setBalance(this.getBalance() - money);
		} else {
			System.out.println("Operation Canceled!");
		}
	}
}

⌨️ 快捷键说明

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