#K85427. Bank Account Simulation
Bank Account Simulation
Bank Account Simulation
You are required to simulate a simple bank account which supports three operations: deposit, withdraw, and check balance. The bank account starts with a balance of 0.
For a deposit, the program should add the specified amount to the balance and output a confirmation message in the following format:
( amount \ has\ been\ successfully\ deposited.\ Your\ new\ balance\ is\ balance. )
For a withdrawal, if there are sufficient funds, the program should deduct the specified amount from the balance and output a confirmation message:
( amount \ has\ been\ successfully\ withdrawn.\ Your\ new\ balance\ is\ balance. ) Otherwise, the program should output an error message: "Insufficient balance, transaction failed."
When the operation is to check the balance, the program should output the current balance in the following format:
( Your\ current\ balance\ is\ balance. )
Input is provided from standard input and output should be produced on standard output.
inputFormat
The first line contains a single integer ( n ) representing the number of operations. Each of the following ( n ) lines contains one operation in one of the following formats:
1. For deposit: deposit X
where X is a positive integer.
2. For withdrawal: withdraw X
where X is a positive integer.
3. For checking balance: check
.
outputFormat
For each operation, output the corresponding message on a new line. The messages must follow the exact format specified in the problem description. For deposit and withdrawal, the output message should display the updated balance immediately after the transaction.## sample
1
deposit 200
200 has been successfully deposited. Your new balance is 200.