Created
September 6, 2013 20:42
-
-
Save rokon12/6469729 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.rokonoid.demo; | |
public abstract class Account { | |
private double initialBalance; | |
private double interest; | |
private int transection; | |
private double bankFee; | |
public Account(double initialAccount) { | |
this.initialBalance = initialAccount; | |
} | |
public double getBalance() { | |
return initialBalance; | |
} | |
public void endMonth() { | |
System.out.println(); | |
System.out.println("-----------endMonth()----------"); | |
System.out.println("Interest: " + interest); | |
System.out.println("Total Transection: " + getTotalTransection()); | |
System.out.println("Bank Fee: " + bankFee); | |
System.out.println("Total Balance: " + calculateTotalBalance()); | |
System.out.println("-----------endMonth()----------"); | |
System.out.println(); | |
} | |
private double calculateTotalBalance() { | |
return (getBalance() - bankFee + interest); | |
} | |
protected void addBalance(double amount) { | |
transection++; | |
initialBalance += amount; | |
} | |
protected void addTransectionFee(double fee) { | |
bankFee += fee; | |
} | |
protected int getTotalTransection() { | |
return transection; | |
} | |
protected void substractBalance(double amount) { | |
if (getBalance() < amount) { | |
System.out.println("Insufficient funds"); | |
return; | |
} | |
transection++; | |
initialBalance -= amount; | |
} | |
public abstract void diposit(double amount); | |
public abstract void withdraw(double amount); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment