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

📄 account.java

📁 本程序用Java语言描述了一个基本的银行管理系统
💻 JAVA
字号:
package banking.domain;

public class Account {
	protected double balance;
	
	public Account(double init_balance){
		this.balance = init_balance;
	}
	
	public double getBalance(){
		return this.balance;
	}
	public boolean deposit(double amt){
		if (amt>0.0){
			this.balance += amt;
			return true;
		}
		return false;
	}
	public void withdraw(double amt) throws OverdraftException{
		if (this.balance-amt>0.0){
			this.balance -= amt;
		}
		else{
			throw new OverdraftException("Insufficient funds", amt-this.balance);
		}
	}
}

⌨️ 快捷键说明

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