Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.*;
- public class SavingsAccount
- {
- private float balance;
- double interestRate = 0.004;
- public float getBalance(){
- return balance;
- }
- public float addInterest() {
- double interest = interestRate * balance;
- balance += (float)interest;
- return balance;
- }
- public void makeDeposit(float depositAmount) {
- balance += depositAmount;
- }
- public SavingsAccount() {
- balance = 0;
- }
- public SavingsAccount(float initialBalance) {
- balance = initialBalance;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement