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

📄 overdraftaccount.java

📁 一些java的小程序.包括排序,一些bank的小计算,
💻 JAVA
字号:
import java.math.*;public class OverdraftAccount extends BankAccount{	// Add new data here.	private double overdraftLimit;	// Constructor with 2 parameters	public OverdraftAccount(String ownersName, double openingBalance)	{		super(ownersName, openingBalance);	}	// Constructor with 3 parameters	public OverdraftAccount(String ownersName, double openingBalance, double aLimit)	{			      super(ownersName, openingBalance);	      if(openingBalance - aLimit > aLimit)		  	overdraftLimit = aLimit;		  else            aLimit = openingBalance;}	// add any get/set methods here.	public void setLimit(double aLimit)	{		overdraftLimit = aLimit;			}		public double getLimit()	{		return overdraftLimit;	}	// Override methods here.	public void withdraw(double amount)	{		double tempBalance = getBalance();		if(Math.abs((tempBalance -= amount)) <= overdraftLimit)		{			setBalance(tempBalance -= amount);		}			}	public String toString()	{		//super.toString();		return super.toString() +", limit:" + getLimit();	}}

⌨️ 快捷键说明

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