Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package assignment8;
- /**
- * Created by codden on 28/01/16.
- */
- public class BSU extends SavingsAccount {
- private double max;
- private double temp;
- public BSU(double interestRate, double max) {
- super(interestRate);
- this.max = max;
- this.temp = 0;
- }
- @Override
- public void deposit (double amount){
- if (this.temp + amount <= max) {
- this.temp += amount;
- super.deposit(amount);
- } else {
- throw new IllegalStateException("Gå og dø");
- }
- }
- @Override
- public void withdraw(double amount){
- if (amount < temp) {
- temp -= amount;
- super.withdraw(amount);
- } else {
- throw new IllegalStateException();
- }
- }
- public double getTaxDeduction(){
- double temp2 = temp;
- temp = 0;
- return temp2 * 0.2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement