Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this lab you will build a BankAccount class. You will then write a Java program that declares an array of BankAccount objects. The program

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

In this lab you will build a BankAccount class. You will then write a Java program that declares an array of BankAccount objects. The program will then provide the user with a menu that lets them view all the balance of the accounts, view a specific account, edit a specific account's data, or exit the program. Step 1 Declare a BankAccount class. The BankAccount class corresponds to the following UML diagram: + BankAccount() + BankAccount (accountNumber : int, firstName : String, lastName : String, middlelnit char,balance : float, lastTransaction : String) + getAccountNumber() : int + setAccountNumber (accountNumber : int)//Non negative accountNumber only + getFirstName(): String + setFirstName(firstName : String) + getLastName(): String + setLastName(lastName : String) + getMiddlelnit(): char + setMiddlelnit( middlelnit : char) + getBalance() : float + setBalance (balance : float) + getLastTransaction() : String + setLastTransaction (lastTransaction : String) + deposit (amount : float, lastTransaction : String) //balance=balance+amount //and set new lastTransaction date //only set positive amounts + withdraw (amount : float, lastTransaction : String) + transfer (amount : float, account : BankAccount, lastTransaction : String) Write a java program called BankAccountProgram that uses the following UML: getData declares and initializes the array of BankAccount objects using this code: accounts = new BankAccount [5]; accounts [0]= new BankAccount (1001, "Danny", "Vito", "D", 3200.50, "07/09/23"); Complete the array with 4 more declarations. Each element of the array is now an instance of the BankAccount object. showMenu Show menu displays a menu that looks like this: Menu 1. Display all accounts 2. Display info for account by account number 3. Edit information for account by account number 4. Deposit into account by account number 5. Withdraw from account by account number 6. Transfer from one account to another 7. Exit The method also reads and returns an integer to the calling point. executeChoice This method accepts an integer and uses an if or a switch statement to handle the values of choice (other than 4). The mechanics of each choice should be handled in a method. For example, the code for choice ==1 might look like this: if (choice==1) menuoption1(); menuOption\# These methods handle the menu options selected by the user. For example menuOption1 would produce the following results: Account Number: 1001 Name: Danny D. Vito Account Number: 1002 Name: Kailtyn D. Olsen wetc choice 2 would look something like this: Account Data Full Name: Danny, Vito D. Balance: 3200.50 Last Transaction: 07/09/23 choice 3 will provide a submenu containing all the accounts. It will ask the user for a number between 1 and accounts.length. That number-1 will be the index of the account to edit. It will then provide a sub menu that asks what field the use wants to edit: 1. First Name 2. Last Name 3. Middle Initial 4. Balance 5. Last Transaction 8. Cancel If choice2 equals 2 , for example, you might do something like this: Choice 4 of the main menu: Enter account id and prompt user how much theyd like to deposit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

4. I can tell when team members dont mean what they say.

Answered: 1 week ago