Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BankAccount {
- private double balance;
- /**
- * constructor for initial balance of balance
- */
- public BankAccount(double initialValue){
- balance = initialValue;
- }
- /**
- * deposit some amount into the account
- * @param amount
- */
- public void Deposit(double amount){
- balance = balance + amount;
- }
- /**
- * withdraw some amount from the account
- * @param amount
- */
- public void Withdraw(double amount){
- balance = balance - amount;
- }
- /**
- * get the balance so you can print it or whatever
- * @return
- */
- public double GetBalance(){
- return balance;
- }
- /**
- * rate of simple interest in bank account
- * @param rate
- */
- public void addInterest(double rate){
- balance = (balance * (rate/100)) + balance;
- }
- }
Add Comment
Please, Sign In to add comment