Bank Project


#1

Hi All,
I am currently working on a Bank project which has 3 classes. Client, Account, and Bank class. Within the bank class I have to do a loop and switch statement to process user input. I have a basic understanding on loop and switch but am struggling with this specific one.

If anyone can help me it would be very much appreciated.
.
c. The main method should:
i. Declare and instantiate a new Bank object.
ii. Use a loop and switch statement to process user input with the following
options:

  1. P or p: call printAccounts
  2. W or w:
    a. prompt for the index of the account
    b. prompt for amount to withdraw
    c. call withdraw method of specified account
    d. if false, output “Insufficient Funds! Balance is $.”
    e. Use DecimalFormat to format the balance.
  3. D or d:
    a. Prompt for the index of the account
    b. Prompt for the amount to deposit
    c. Call deposit method of the specified account
  4. Q or q:
    a. Quit program.
    b. Do NOT use System.exit()!

#2

In your cases have it like this… case ‘p’ || ‘P’. Or what else you can do is change whatever the user enters into a capital letter by converting to ASCII. That way you only have to check for the capital in your cases.