Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bailey Bank is a national bank that offers a wide array of financial products. Their newest product, Individual Deposit Account is a program that will

Bailey Bank is a national bank that offers a wide array of financial products. Their newest product, Individual Deposit Account is a program that will constantly receive requests for customers to move money in and out of their accounts. As the new technical lead, you have been tasked with implementing this program. Your program will receive inputs for three types of transactions: deposits, withdrawals, and transfers from one account to another. These inputs will come in a constant stream that needs to be processed in batches. In each batch, your program needs to output all account balance changes that have taken place in that batch. Your program will be given the batch size that it needs to use to batch inputs. In addition to computing account balances, your program also needs to flag accounts that are engaging in suspicious activities. An account should be flagged as suspicious if it is participating in a high number of transfers over a short period of time, as either the sender or recipient. Your program will be given a transfer limit and a fraud window size. It should flag an account if it hits or exceeds the transfer limit over any set of consecutive transactions matching the fraud window size. For example, if transfer_limit = 3 and fraud_window_size= 10, your program should flag an account if it is involved in 3 or more transfers in the past 10 consecutive transactions. In each batch, after printing out account balances, your program should print out any newly detected suspicious accounts. An account should only be flagged as suspicious once throughout the duration of your program, even if it continues to engage in suspicious transfers after it has been flagged. Input (stdin) Your program should read from standard input. The first three lines are numerical values indicating the aforementioned batch size, transfer limit, and fraud window size in order. The rest is a comma-delimited list of transactions. You can assume the input is valid. Each transaction type is structured in the following format: deposit: deposit, , transfer: transfer,, , withdraw: withdraw, , (list of transactions) Output (stdout) For each batch, first print balance changes, then flagged accounts, separated by a new line. Account balances for each batch are independent, so your output should reset all balances between batches, and only print out accounts named that have had transactions in the most recent batch. If there is no flagged account in a batch, simply output string EMPTY. As a reminder, you only need to flag an account once across all batches, whenever the suspicious account is first detected. Outputs should be sorted by . Each balance change line should have the format: , . Each flagged account line should have the format: (list of balance changes) Input Example 1 3 4 5 deposit,1,100 withdraw,2,100 transfer,1,2,100 transfer,1,3,100 deposit,2,100 Output Example 1 1,0 2,0 EMPTY 1,-100 2,100 3,100 EMPTY Input Example 2 5 3 5 deposit,1,200 transfer,1,2,200 deposit,2,200 transfer,2,1,200 transfer,1,3,100 transfer,1,2,100 transfer,3,2,100 Output Example 2

1,100 2,200 3,100 1

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

Differentiate. y = ln(3x + 1) ln(5x + 1)

Answered: 1 week ago

Question

9. What are the characteristics of effective crisis communication?

Answered: 1 week ago