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

📄 creditaccount.java

📁 通过图形用户界面输入一句话
💻 JAVA
字号:
/**
 * 
 */
package com.hp.gdcc.training.homework39;

/**
 * @author yanshuo
 *
 */
public class CreditAccount extends Account {
	/**
	 * 透支额度
	 */
	private double ceiling;
	public CreditAccount() {
		// TODO Auto-generated constructor stub
	}
	/**
	 * 构造方法
	 * 
	 * @param id
	 * @param password
	 * @param name
	 * @param personId
	 * @param email
	 * @param accountType
	 */
	public CreditAccount(long id, String password,
			String name, String personId, String email, int accountType) {
		super(id, password, name, personId, email, accountType);
	}
	
	/**
	 * 取款方法
	 * 
	 * @param withdrawAmount
	 * @return boolean(true:取款成功; false:取款失败;)
	 */
	public boolean withdraw(double withdrawAmount){
		double balance = this.getBalance();
		double balanceAfterWithdraw = balance - withdrawAmount;
		if(balanceAfterWithdraw >= -this.ceiling){
			this.setBalance(balanceAfterWithdraw);
			return true;
		}else{
			return false;
		}
	}	
	
	public double getCeiling() {
		return ceiling;
	}

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

⌨️ 快捷键说明

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