Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Requirements Create an abstract class called Account that has the following attributes: accountNumber: A string representing the account number. balance: A double representing the balance
Requirements
Create an abstract class called Account that has the following attributes:
accountNumber: A string representing the account number.
balance: A double representing the balance of the account.
A constructor that initializes all the attributes.
An abstract method called withdraw that takes a double representing the amount to withdraw and returns a boolean indicating whether the withdrawal was successful.
An abstract method called deposit that takes a double representing the amount to deposit and returns a boolean indicating whether the deposit was successful.
Create three classes that inherit from Account:
SavingsAccount: A class representing savings accounts.
CheckingAccount: A class representing checking accounts.
CreditCardAccount: A class representing credit card accounts.
Create a class called Bank that has the following methods:
addAccountAccount account: Adds an account of type Account to the bank.
removeAccountAccount account: Removes an account of type Account from the bank.
getAccounts: Returns a list of accounts in the bank.
getAccountString accountNumber: Returns the account with the specified account number.
Create a class called Transaction that has the following attributes:
accountNumber: A string representing the account number.
amount: A double representing the amount of the transaction.
type: A string representing the type of the transaction withdrawal or deposit
A constructor that initializes all the attributes.
Create a class called TransactionManager that has the following methods:
addTransactionTransaction transaction: Adds a transaction of type Transaction to the transaction manager.
removeTransactionTransaction transaction: Removes a transaction of type Transaction from the transaction manager.
getTransactions: Returns a list of transactions in the transaction manager.
Create a class called BankManager that has the following methods:
createAccountAccount account: Creates a new account of type Account.
deleteAccountAccount account: Deletes an account of type Account.
updateAccountAccount account: Updates an account of type Account.
addTransactionTransaction transaction: Adds a transaction of type Transaction to the transaction manager.
removeTransactionTransaction transaction: Removes a transaction of type Transaction from the transaction manager.
getTransactions: Returns a list of transactions in the transaction manager.
Create a class called BankThread that implements Runnable. The BankThread class should have the following methods:
run: The main method that runs the thread. This method should use a ReentrantLock to manage concurrent access to shared resources.
readFromFile: A method that reads account information from a file using FileInputStream.
writeToFile: A method that writes account information to a file using FileOutputStream.
Create a class called BankApp which will be your runner that has main method that creates and starts the threads.
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