All Problems
mediumOOP

Bank Account Class

Problem Statement
Create a BankAccount class with deposit, withdraw, and balance check methods. Process a series of transactions.

SAMPLE INPUT

1000
deposit 500
withdraw 200
balance

SAMPLE OUTPUT

Deposited 500. Balance: 1500
Withdrew 200. Balance: 1300
Balance: 1300

CONSTRAINTS

  • Initial balance >= 0
  • Cannot withdraw more than balance

Explanation: Use a class with methods for each operation.

Code Editor
Output
Click "Run" to see output...