To work with Ruby's control structures
Instructions
For this lab you will be using the BankAccount class we created in class to write a small interactive Ruby program to simulate the workings of the worlds smallest and simplest bank.
Your task is to create a Ruby program that displays a menu to the user with the following options: Open Account, List Accounts, Make Deposit, Make Withdraw, and Exit.
When the program first starts it should contain no BankAccount instances but when the user chooses option 1 Open Account the program should create a new BankAccount instance and store it in an array. Every time the user chooses this option a new account should be created and added to the array but the user should not be allowed to open more than 5 accounts. The program does not need to be persistent in that each time the program is restarted it will start with no accounts.
When the user chooses option 2 View Accounts they should be shown a list of all existing accounts including the account number, the balance, and the name on the account.
When the user chooses option 3 Make Deposit the user should be prompted for both the amount to deposit and which account they want to deposit to which will mean that the user needs to be shown a list of available accounts to choose from. When the user has entered an amount and selected an account the deposit should be made.
When the user chooses option 4 Make Withdraw the user should be again prompted for the amount and which account to withdraw from making this option almost identical to the Deposit options except that a withdraw will be performed instead of the deposit.
Finally, when the user chooses option 5 Exit the program should end. Until the user chooses option 5 Exit the program should continue to loop, taking the user back to the main menu after any option has been selected and completed.