Advertisement
Guest User

Untitled

a guest
Dec 18th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. import java.io.*;
  2. public class SavingsAccount
  3. {
  4. private float balance;
  5. double interestRate = 0.004;
  6.  
  7. public float getBalance(){
  8. return balance;
  9. }
  10.  
  11. public float addInterest() {
  12. double interest = interestRate * balance;
  13. balance += (float)interest;
  14. return balance;
  15. }
  16.  
  17. public void makeDeposit(float depositAmount) {
  18. balance += depositAmount;
  19. }
  20.  
  21. public SavingsAccount() {
  22. balance = 0;
  23. }
  24.  
  25. public SavingsAccount(float initialBalance) {
  26. balance = initialBalance;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement