CODE CREATIVE
BANK ACCOUNT
A financial simulation
TASK #1
Watch the video below to see an example of the "Bank Account" program running.


CHALLENGE EXERCISE #1
  1. Define the "Client" class, its instance variables, and its constructors.
    • The "Client" class has the following instance variables: first name, last name, username, password, personal account balance, and a business account balance.
  2. Define the "BranchBanking" class, its instance variables, and its constructors.
    • This class contains an ArrayList of "Client" objects.
  3. Define the "CorporateOffice" class, its instance variables, and its constructors.
    • This class contains an ArrayList of "BranchBanking" objects.




TASK #2
TASK:
Create a CorporateOffice object.

HINT:
In the driver, create an arrayList of "BranchBanking" objects to pass to the "CorporateOffice" constructor. Be sure to use unique information for each client object. You can check the syntax for creating an arrayList here. Remember that you will need to import "java.util.ArrayList" for your program to be able to create an arraylist.

CHECK UP:
Watch the video below for a more thorough explanation of how to complete the task.
TASK #3
TASK:
Define the toString() methods in "Client", "BranchBank", and "CorporateOffice". Remember that driver classes never have a toString() because they don't have instance variables. The driver class is only used to create objects and use them to accomplish a task.

HINT:
toString() methods print out the values of an object's instance variables in a user friendly format. Remember that the toString() method is a part of the "Big-3"(instance variables, constructors, toString()) and is a necessary addition to every class outside of the driver class which contains the main method.

After completing this task, the program should print out all the values of all 16 clients' instance variables.

CHECK UP:
Watch the video below for a more thorough explanation of how to complete the task.


CHALLENGE EXERCISE #2
  1. Ask the user to input their username and password.




TASK #4
TASK:
Search the "CorporateOffice" object to find the "Client" object. Your program must have a CorporateClass method called getClient(). Your BranchBanking class must also have a method called getClient(). You must use both of these methods when looking for the Client object.

HINT:
To search for the "Client" object, you will need to search through the "CorporateOffice" object's arrayList of "BranchBanking" objects. Then, for each "BranchBanking" object, you will need to search through it's arrayList of "Client" object's and compare what the user entered with the values of the object's "username" and "password" instance variables.

To accomplish this task, you will need to use nested for loops.

CHECK UP:
Watch the video below for a more thorough explanation of how to complete the task.


CHALLENGE EXERCISE #3
  1. In the driver, use a branch statement whose condition is based on whether the credentials are found.
  2. If the credentials are found, print out the menu described in the guide.
    • Based on the user's input, run the corresponding method that will accomplish the task using the relevant "Client" object.
  3. If the credentials are not found, print out an error message.
    • Your program should loop if this is the case.






CHALLENGE EXERCISE #4
  1. Define the method personalDeposit() in the Client class.
  2. Define the method personalWithdrawal().
  3. Define the method personalBalance().
  4. Define the method businessDeposit().
  5. Define the method businessWithDrawal().
  6. Define the method businessBalance().
  7. Remember to test each method!






CHALLENGE EXERCISE #5
  1. If the user enters '1' and '-1' for their credentials, print the corporate menu, and read in the user's input.




TASK #5
TASK:
Define the method printClientInfo() in the "CorporateOffice" class.

HINT:
Since this method prints out the values of all the instance variables of each client in the system, we simply need to run the CorporateOffice object's toString() method.

CHECK UP:
Watch the video below for a more thorough explanation of how to complete the task.
CHALLENGE EXERCISE #6
  1. Define the method getPersonalInfo().
  2. Define the method getBusinessInfo().
TASK #6
TASK:
Define the method checkProfit() in the "CorporateOffice" class as described in the guide.

HINT:
You will need to define a CorporateClass method called getBalances() that will iterate through each BranchBanking object. You will also need to define a BranchBanking method called getBalances() that will iterate through each client. Finally, you will need to sum the total amounts in each client's account to be used in the calculation described in the guide.

CHECK UP:
Watch the video below for a more thorough explanation of how to complete the task.
CHALLENGE EXERCISE #6
  1. Define the method checkPersonalProfit().
  2. Define the method checkBusinessProfit().
  3. Remember to check that each method works!
.
.
Congratulations, you have completed the Bank Account project!