#C14682. Basic Banking System Simulation
Basic Banking System Simulation
Basic Banking System Simulation
You are required to implement a basic banking system simulator. The system supports the following operations:
- create_account <account_number> <user_name> <initial_balance>: Create an account with the given account number, user name, and initial balance. Assume that the account number is unique and the initial balance is a non-negative integer.
- deposit <account_number> <amount>: Deposit the specified positive amount to the account.
- withdraw <account_number> <amount>: Withdraw the specified positive amount from the account. It is guaranteed that the account has sufficient funds.
- check_balance <account_number>: Print the current balance of the account to stdout.
- get_transaction_history <account_number>: Print the transaction history of the account. Each transaction is recorded as a string in the format
Deposit: amount
orWithdrawal: amount
. If there are no transactions, printNo Transactions
.
Your program will read commands from stdin
. The first line of input contains an integer \(N\) indicating the number of commands, followed by \(N\) commands (one per line). Your task is to process the commands and output the results of every check_balance
and get_transaction_history
command to stdout
(each output on a new line).
All formulas should be written in LaTeX format. For example, the number of commands is given as \(N\) in the first line of input.
inputFormat
The input starts with an integer \(N\) on the first line (\(1 \leq N \leq 10^5\)), representing the number of commands. Each of the following \(N\) lines contains a command in one of the following formats:
create_account <account_number> <user_name> <initial_balance>
deposit <account_number> <amount>
withdraw <account_number> <amount>
check_balance <account_number>
get_transaction_history <account_number>
Values are separated by a single space. You can assume that all commands are valid and that operations like deposit/withdraw occur on existing accounts and have valid amounts.
outputFormat
For each check_balance
command, output a single line containing the account balance (an integer). For each get_transaction_history
command, output a single line that is a comma-and-space separated list of transactions (e.g. Deposit: 500, Withdrawal: 200
). If there are no transactions for the account, output No Transactions
.
5
create_account 123456 Alice 1000
deposit 123456 500
withdraw 123456 200
check_balance 123456
get_transaction_history 123456
1300
Deposit: 500, Withdrawal: 200
</p>