// Represents a bank account balance 	
	
public class BankAccount {	
	// instance variable 	
	int balance;	
	
	// BankAccount(): default constructor for a new empty balance 	
	public BankAccount() {	
		balance = 0;	
	}	
	
	// BankAccount(): specific constructor for a new balance n 	
	public BankAccount(int n) throws NegativeAmountException {	
		if (n >= 0) {	
			balance = n;	
		}	
		else {	
			throw new NegativeAmountException("Bad balance");	
		}	
	}	
	
	// getBalance(): return the current balance 	
	public int getBalance() {	
			return balance;	
	}	
	
	// addFunds(): deposit amount n 	
	public void addFunds(int n) throws NegativeAmountException {	
		if (n >= 0) {	
			balance += n;	
		}	
		else {	
			throw new NegativeAmountException("Bad deposit");	
		}	
	}	
	
	// removeFunds(): withdraw amount n 	
	public void removeFunds(int n) throws NegativeAmountException {	
		if (n < 0) {	
			throw new NegativeAmountException("Bad withdrawal");	
		}	
		else if (balance < n) {	
			throw new NegativeAmountException("Overdrawn");	
		}	
		else {	
			balance -= n;	
		}	
	}	
}	
	
