Question: IN JAVASCRIPT PLEASE Problem Statement: Your local bank is now growing is needs more flexibility to add more customers and accounts. You are going to
IN JAVASCRIPT PLEASE
Problem Statement: Your local bank is now growing is needs more flexibility to add more
customers and accounts.
You are going to revise program by adding aggregaon and arrays.
A slightly modified Account and CD class have been provided to you.
You will add a Customer class, that will create a customer and store the accounts associated
with that customer and will rewrite the Driver class that reflects the changes in the course
design.
Changes in Account: Removed the hasCD boolean variable.
Changes in CD: CD account numbers begin with instead of the previous
Design:
You will include the following classes:
o Account and CD provided
o Customer
o BankDriver
Customer Class: This class stores the informaon about the customer, as well as two arrays
that store all of the account informaon for each customer.
Instance variables:
customerID this will be a randomly generated number
first and last name
social security number
an array that stores objects of the Account class
an integer variable to keep track of the size of the account array
an array that store objects of the CD class
an integer variable to keep track of the size of the CD array
an array that stores the randomly assigned account numbers
an integer variable to keep track of the size of the random array
Methods:
Constructor that accepts the first and last name and social security number. This method
will call createCustIDNumber to generate a random number to assign to the customerID.
Instanate the two arrays. Set the array of accounts to size and the CD array to size
Create geters as they are needed in your program. Do not create geters that are not
used.
createCustomerIDNumber This method will randomly assign a number from to
It will then search the random number array to ensure that number has not already
been assigned. If it is a unique number, then return that number. If the number has been
assigned, it will generate a new random number.
addAccount This method receives an account object and stores that object in the
account array and increments the counter for that array.
addCD This method receives a CD object and stores that object in the CD array and
increments the counter for that array
toString Outputs all of the informaon Note that if there are no accounts, the output
should display that there are no accounts.
Customer Name: Tonya Pierce
Customer ID Number:
Social Security Number:
Accounts: Account Number:
Owner Name: Tonya Pierce
Account Type: checking
Balance: $
Account size:
CDs: No CD accounts.
CD size:
BankDriver class: This class contains the main method, and will display the menu of opons
in a loop unl the user chooses to quit. For each menu opon there should be a method to
complete the task. Your main class should be minimalisc and only include the tasks for the
menu loop and closing tasks.
Global variables:
Scanner object
A Customer array that holds customers.
Stac methods:
createNewCustomer This method will get the customers full name and social security
number. Since customer name is stored as first and last name, you will need to substring
it down into the first and last name. Create a Customer object and store that object into
the Customer array and increase the array size. Since the only input here are Strings, no
data validaon is necessary. However, you must enter the users full name correctly.
createAccount This method gets the customer ID and deposit amount, as well as the
account type. It should then search the Customer array for the correct customer ID and
call the addAccount method in Customer and store it in the array at the appropriate
index, based on the customer ID Validate customer ID for type and range. Validate
deposit amount and account type for data type.
deposit This method will get the account number of the customer and the deposit
amount. It will then search the Customer array for a matching ID Number. If a match,
then it will search the accounts array and for each account, it will:
o retrieve the account number
o Output the account number and ask if it is the correct account.
o If the user says yes then call the deposit method from the account class for that
customer
o Validate customer ID for type and range. Validate deposit amount for type.
withdraw Do the same for withdraw as you did for deposit except call the withdraw
method form the account class for that customer. Validate customer ID for type and
range. Validate withdraw amount for type.
createCD This method will create a CD for the correct customer based on customer ID
This method will prompt the user for the customer ID and deposit amount. It will then
search the Customer array for the correct customer based on customer ID If it locates
the correct customer, it will concatenate the first and last name to combine into the
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
