MIAMI DADE COLLEGE School of Engineering and Technology COP XXXXXXXXXXJava Programming Project 5 Due On: 4/22/2020 by 11:59 PM   Expand Project 4 as follows: Using the BankAccount class as a base...


MIAMI DADE COLLEGE




School of Engineering and Technology







COP 2800 - Java Programming





Project 5



Due On: 4/22/2020 by 11:59 PM



Expand
Project 4
as follows:



  1. Using the
    BankAccount
    class as a base class, write two derived classes called
    SavingsAccount
    and
    CheckingAccount.

  2. Add a new private field
    name
    of type String to the
    BankAccount
    class.

  3. Add accessor and mutator methods for the
    name
    field.

  4. A
    SavingsAccount
    object, in addition to the attributes of a
    BankAccount
    object, should have a
    monthlyInterest
    variable and a method, which adds interest to the account. Assume you are adding the interest accumulated in a month.


//monthlyInterest += (accountBalance * (annualInterestRate / 12))


//accountBalance += monthlyInterest



public void addInterest() {



//code goes here



};



  1. The
    CheckingAccount
    class, in addition to the variables of a
    BankAccount
    class, should have an
    overdraftLimit
    variable (default to $50). Ensure that you override methods of the
    BankAccount
    class as necessary in both derived classes.


Create a
Bank
class, which contains an
ArrayList
of
BankAccount
objects called
bankAccounts.
BankAccounts in the array could be instances of the
BankAccount
class, the
SavingsAccount
class, or the
CheckingAccount
class.


Write an
update
method in the
Bank
class. It iterates through each account, updating it in the following ways:


Savings accounts get interest added (via the
addInterest
method)


Checking accounts get a letter sent (System.out.println) if they are in overdraft. (Hint: use
instanceof
operator)



  1. The
    Bank
    class requires methods for
    openAccount
    and
    closeAccount.



    1. openAccount()
      should ask the user for:


      1. his/her name (just first name, no last name)

      2. what type of bank account (s)he wishes to open. Options are
        Regular
        Account (BankAccount
        object),
        Savings
        (SavingsAccount
        object) or
        Checking
        (CheckingAccount
        object). Create an object of the appropriate type and add it to
        bankAccounts. Display the account Id after this operation.

      3. Initial Balance (minimum $100). Display a message if the user tries to open an account with less than $100 deposit (make sure account does not get created).



    2. closeAccount()
      should ask the user for his/her name and the account Id and then delete from
      bankAccounts
      the account that matches both the
      name
      and
      accountId. If they have a balance print a message indicating that a check with a balance will be mailed to them (indicate amount).


  2. Test all your classes in the
    TestBankAccount
    class. Send all output to the console. Use a
    Scanner
    object to get user responses and
    System.out.println
    to print to the console.


Additional Hints:


Note that the balance of an account may only be modified through the deposit (double) and withdraw (double) methods.


Changes to the original
BankAccount
class should be minimal.


Make sure to test what you have done after each step.


Make sure to include enough testing in
TestBankAccount
to cover all the functionality implemented.





Submission guidelines:
Send your code files
(BankAccount.java, SavingsAccount.java, CheckingAccount.java, Bank.java and TestBankAccount.java)
as attachments to my email
[email protected], with the subject
Java

Project

5




May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here