Goal1: Finish the BankAcct class.
- Complete these methods:
- The constructor sets the account number and balance
- Accessors: getBalance and getAcctNo
- Mutators: deposit and withdraw
- Run the TestBankAcct main method to be sure your bank account works
Goal2: Finish the CheckAcct class.
- The only thing that is different is that the withdraw method withdraws an additional 50 cents for each withdrawal transaction.
- A subclass should have its own constructor, even if all it does is call the superclass constructor
- Run TestCheckAcct to check your code.
Goal3: Finish the SavAcct class.
- A savings account has 2 additional variables: interest rate and low balance, these must be initialized in the constructor in addition to the 2 bank account variables. Low balance is the lowest balance for the current period. Initially lowbal = bal.
- When withdrawing from a savings account, the balance cannot fall below 0. If the customer attempts to withdraw too much, only the allowable amount is withdrawn. Each time a withdrawal is made, the method checks to see if this is the lowest balance, if so, the low balance is saved in the lowbal variable.
- A savings account has an additional method: addInt to add interest. Muliply the interest rate * lowbal and deposit that amount in the account. This is the end of the current period. Set lowbal equal to the current balance for the start of the new period.
- Run TestSavAcct to test your savings account code.
Goal4: Complete the implementation of the MMAcct class.
- Which methods need to be implemented?
- Create your own test for your MMAcct class:
- Test #1:
- Create a Money Market account with account number “B2345”, initial balance 5000.00 dollars, and interest rate 0.02.
- Withdraw 1000.00 dollars.
- Deposit 50.00 dollars.
- Add interest.
- Print out the account number and balance (the balance should be 4130.00 dollars)
- Test #2:
- Create a Money Market account with account number “B2345”, initial balance 3000.00 dollars, and interest rate 0.02.
- Withdraw 1000.00 dollars.
- Deposit 80.00 dollars.
- Add interest.
- Print out the account number and balance (the balance should be 2120.00 dollars.)