Question
Note: I need the program with output and send the source file (.java file) and the compiled file (.class file) and please address all the
Note: I need the program with output and send the source file (.java file) and the compiled file (.class file) and please address all the 3 questions.
Problem Define classes: Bank, BankAccount and Transaction. 1) The Transaction class has instance variables: initial balance, transaction type (deposit or withdrawal), transactionAmount, and updated balance. 2) The BankAccount class has private instance variables: account type, account number, balance, and an array/arraylist of transactions. You should use appropriate data types and write: setters and getters a constructor that takes an account type, account number and a balance for initializing respective instance variables. a method deposit() that takes the amount to deposit as the argument and the method will update the account balance. a method withdraw() that takes the amount to withdraw as the argument and the method will update the account balance. A method displayAccount() that displays the account type (i.e. Savings or Checking), account number, and the list of transactions conducted - each transaction should show the initial balance, the transaction (withdrawal or deposit) amount, and the updated balance after each transaction. 3) The Bank class has instance variables: a bank name, an address, an array or ArrayList of BankAccount. You should write:
A method initAccountList() that takes an integer n for creating n BankAccount objects (by using the constructor defined in the BankAccount class) and store in the array/ArrayList instance variable. The account number starts from 101, incremented by 1. Odd account numbers are for Savings. The Savings balance starts at $500 and increments by $500, for each subsequent account. You are required to use a loop to initialize the array/ArrayList in the method (You MUST NOT hardcode). Even account numbers are for Checking. Again, use a loop to set the beginning balance of each Checking account to be 50 times the account number. A method displayAllAccounts() that displays all the account information in the array/ArrayList (Hint: call the displayAccount() in the BankAccount class). A method findAccount() that takes an account number and returns the index of that account in the array or ArrayList. Display appropriate message if the account does not exist. A method addAccount() that adds a BankAccount object to the array/ArrayList.
The program must allow users to continually perform the following operations until they choose to quit: 1. The new bank account with the beginning balance and type from the user, and the account number to be continued from the last account number in the array/ArrayList. This newly created BankAccount object will be added to the array/ArrayList. 2. To make a deposit on a bank account based on the account number entered by the user. The updated account information will be displayed. 3. To make a withdrawal on a bank account based on the account number entered by the user. The updated account information will be displayed. 4. To display information of a specific account. 5. To display all the account information.
As for every program, it is important to display clear and meaningful instructions for users to enter needed information. Similarly, all displays should be well-formatted and clear, including the monetary values with only two digits after the decimal point.
Submission Your assignment must be submitted on Canvas. You should name the folder as A4-FirstnameLastname before zipping for submission. The zipped file must contain: a) All the source files (.java files), and b) All the compiled files (.class files)
Step 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