he Identity of the Customer it belongs to. The program should run in a loop; continuously asking the user to enter the basic details of the customer and their account. After getting all details about a Customer and their corresponding accounts, the program should ask the user whether he/she wants to enter the detail of another customer. The above process should continue if the user enters “Y” for Yes. The program should terminate and display a list of the entered customers and their accounts if the user enters “N” for No.
JAVA
Write a program named AccountManager which stores customers’ details including their
accounts. A customer can have more than one accounts. You can achieve this by introducing two
classes i.e. Customer and Account. The Account class will have a data member named
CustomerID which will store the Identity of the Customer it belongs to.
The program should run in a loop; continuously asking the user to enter the basic details of the
customer and their account. After getting all details about a Customer and their corresponding
accounts, the program should ask the user whether he/she wants to enter the detail of another
customer. The above process should continue if the user enters “Y” for Yes. The program should
terminate and display a list of the entered customers and their accounts if the user enters “N” for
No.
The program must be user-friendly. Part of this problem is to get practice writing programs that
are robust to user input errors, so you should check user input for errors, such as value that is
invalid, or beyond the bounds. One account is associated to one customer only and a customer
may have zero, one or more accounts. While getting a new account number, the program must
check if the given account number is already associated with another customer.
If an error is detected, the program should print a helpful message and allow the user to try again.
Here is a sample of what an interactive session might look like:
Please Enter Customer Details
Customer ID: 123
Customer Name: Ali Hassan
Phone Office: 0454455334
Cell No: 03004400506
Billing Address: House No. 123, Nowhere.
CNIC No. 33102-7748298-5
Do you want to enter Ali Hassan’s Account Details? (Y/N): Y
(Here, we are not asking user to enter the Customer ID because it
is understood that we are going to enter Ali Hassan’s account
detail so we will set CustomerID field of the Account class as 123
at backend).
Enter Account No: 19154400556743
Bank: Habib Bank
Bank Branch: UET Taxila
Account Type (Enter C: Current, S: Saving, P: PLS): P
Current Balance (Rs.): 33,000
Do you want to enter Ali Hassan’s another account Detail? Y
Enter Account No: 037655445674
Bank: Allied Bank Ltd.
Bank Branch: GT Road, Taxila
Account Type (Enter C: Current, S: Saving, P: PLS): C
Current Balance (Rs.): 25,000
Do you want to enter Ali Hassan’s another account Detail? N
Do you want to enter another customer’s details? (Y/N) N
Step by step
Solved in 2 steps