# i need help writing this assignment

• March 12th, 2013, 10:58 PM
chineduezeoru
i need help writing this assignment
Design an abstract class named 1. BankAccount to hold the following data for a bank account:
• Balance
• Number of deposits this month
• Number of withdrawals
• Annual interest rate

The class should have the following methods:

Constructor:
The constructor should accept arguments for the balance and annual interest rate.

Deposit:
A method that accepts an argument for the amount of the deposit. The method should add the argument to the account balance. It should also increment the variable holding the number of 2 deposits.

Withdrawal:
A method that accepts an argument for the amount of the withdrawal. The method should subtract the argument from the balance. It should also increment the variable holding the number of withdrawals.

calculateInterest:
A method that updates the balance by calculating the monthly interest earned by the account, and adding this interest to the balance. This is performed by the following formulas:

Monthly Interest Rate = (Annual Interest Rate / 12)
Monthly Interest = Balance * Monthly Interest Rate
Balance = Balance + Monthly Interest

Next, design a 2. SavingsAccount class that extends the BankAccount class. The SavingsAccount class should have a status field to represent an active or inactive account. If the balance of a savings account falls below \$20, it becomes inactive. (The status field could be a boolean variable.) No more withdrawals can be made until the balance is raised above \$20, at which time the account becomes active again. The savings account class should have the following methods:

withdraw:
A method that determines whether the account is inactive before a withdrawal is made. (No withdrawal will be allowed if the account is not active.) A withdrawal is then made by calling the superclass version of the method.

deposit:
A method that determines whether the account is inactive before a deposit is made. If the account is inactive and the deposit brings the balance above \$20, the account becomes active again. The deposit is then made by calling the superclass version of the method.
Finally, you must provide a 3. CreateAccounts class (GUI based) that demonstrates the functionality of the SavingsAccount. Make sure that the main method in this class creates an instance of SavingsAccount classes and then calls the appropriate methods. For example, it is important to demonstrate that the instance of the SavingsAccount class will compute the appropriate interest values. This class should interact with the user by providing a GUI. As long as you demonstrate the correctness of your SavingsAccount, you are free to implement the CreateAccount in any fashion that you think is acceptable

Assignment work
1. First draw an interface stating …
First interface will have welcome to smart banking