Answered step by step
Verified Expert Solution
Link Copied!

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:
addAccount(Account account): Adds an account of type Account to the bank.
removeAccount(Account account): Removes an account of type Account from the bank.
getAccounts(): Returns a list of accounts in the bank.
getAccount(String 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:
addTransaction(Transaction transaction): Adds a transaction of type Transaction to the transaction manager.
removeTransaction(Transaction 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:
createAccount(Account account): Creates a new account of type Account.
deleteAccount(Account account): Deletes an account of type Account.
updateAccount(Account account): Updates an account of type Account.
addTransaction(Transaction transaction): Adds a transaction of type Transaction to the transaction manager.
removeTransaction(Transaction 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

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

Students also viewed these Databases questions

Question

Tell me what you know about our organization and the position.

Answered: 1 week ago