Question
Java: Consider the Account class you created in problem 1 above. Create a class named UserAccounts that defines an array of 8 accounts as an
Java: Consider the Account class you created in problem 1 above. Create a class named UserAccounts that defines an array of 8 accounts as an instance variable. In the default constructor of this class, write a loop that creates 8 accounts with ids 1 through 7 and initial balance of $50 for each account. Store these accounts in the array. When the program runs, it asks the use to enter a specific id. When the user enters a correct id, the system displays a menu as shown in the sample run below. The menu options are self explanatory. Option 4 exits the main menu. So if option 4 was chosen, the system will prompt the use again to enter another id. This means that the system will keep running indefinitely.
Outline3 Account a id: int a balance: double a annuallnterestRate: double a dateCreated: Date Account0 Account(int, double) e getlD0: int e setlD(int): voic e getBalance0: double e setBalance(double) : void O getAnnuallnterestRate0: double e setAnnuallnterestRate(double): void e getDateCreated0: Date getMonthlylnterestRate0: double e withdraw(double): void o deposit(double): void Here's a sample run: ter an 1d Main menu 1: check balance 2: withdraw 3: deposit 4: exit Enter a choice: The balance is 5 . Main menu 1: check balance : withdraw 3: deposit : exit Enter a choice: 2 Enter an amount to withdraw: 25 Main menu 1: check balance 2 withdraw 3: deposit exit Enter a choice: 1 The balance is 25. Main menu 1 check balance 2: withdraw 3: deposit 4: exit Enter a choice: 3 Enter an amount to deposit 1e Main menu : check balance 2 withdraw 3: deposit : exit Enter a choice 1 The balance is 35.e Main menu 1: check balance 2: withdraw 3: deposit 4: exit Enter a choice: 4 Enter an idStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started