Need some work done? Post a Project Today
The objective is to implement Bank database that can efficiently respond to queries. A
Bank comprises a "list" of customers and a "list" of accounts (You need to use binary
search trees to implement these). Two files, bank0.txt and bank1.txt contain customer
and account data for two different banks. The top section of each file comprises
customer records and the bottom section account records. Each customer record
comprises a customerID, a lastName, a firstName and an address (just a town). Each
account record comprises an accountID, a customerID and a balance (in cents). The two
parts of the file are separated by a blank line. customerIDs and accountIDs are unique.
A customer may have more than one account, but an account may not belong to more
than one customer (ie. no joint accounts). customerIDs start at 80000000 and
accountIDs start at 90000000.
Implement Customer, Account, Bank and any other appropriate objects in order to
implement the bank database. Create two Bank objects with bankIDs 0 and 1 and
populate them with data from the files bank0.txt and bank1.txt respectively.
Write code to answer the following general queries.
1. Given a bankID, display
a. the number of customers
b. the number of accounts
c. the sum of all accounts (the bank balance)
2. Given a bankID and a customerID, display the customer information.
3. Given a bankID and an accountID, display the account and customer information.
4. Given a bankID, calculate and display average customer balance.
5. Write a function that transfers a random amount of money from one random account
to another random account (a transaction). Organise it so that this function is run by a
worker thread. Given a PC with N cores (CPUs), count the total number of transactions
per second performed with 1 to 2*N threads. Verify that the bank balance is identical
before and after the test when executed using more than one thread.