
									 Problem
								
								
									 Solution
								
								
									 Submissions
								
								
							Simulate a basic ATM machine
								Certification: Basic Level
								Accuracy: 66.67%
								Submissions: 6
								Points: 5
							
							Write a C# program to simulate a basic ATM machine. The ATM should handle operations like deposit, withdraw, and check balance.
Example 1
- Input: 
- Deposit(1000)
 - Withdraw(500)
 - CheckBalance()
 
 - Output: 
- Deposit successful. New balance: 1000
 - Withdrawal successful. New balance: 500
 - Current balance: 500
 
 - Explanation: 
- Step 1: Initialize the account with a balance of 0.
 - Step 2: Deposit 1000, increasing the balance to 1000.
 - Step 3: Withdraw 500, decreasing the balance to 500.
 - Step 4: CheckBalance returns the current balance, which is 500.
 
 
Example 2
- Input: 
- Withdraw(200)
 - Deposit(-100)
 - Withdraw(1000)
 - CheckBalance()
 
 - Output: 
- Insufficient funds. Current balance: 0
 - Invalid deposit amount. Amount must be positive.
 - Insufficient funds. Current balance: 0
 - Current balance: 0
 
 - Explanation: 
- Step 1: Initialize the account with a balance of 0.
 - Step 2: Attempt to withdraw 200 fails due to insufficient balance.
 - Step 3: Attempt to deposit -100 fails because the amount is negative.
 - Step 4: Attempt to withdraw 1000 fails due to insufficient balance.
 - Step 5: CheckBalance returns the current balance, which is still 0.
 
 
Constraints
- The balance cannot be negative
 - Deposit amounts must be positive
 - Withdrawals cannot exceed the available balance
 - 0 ≤ Number of operations ≤ 100
 - 0 ≤ Transaction amounts ≤ 10^6
 - Time Complexity for all operations: O(1)
 - Space Complexity: O(1)
 
Editorial
									
												
My Submissions
										All Solutions
									| Lang | Status | Date | Code | 
|---|---|---|---|
| You do not have any submissions for this problem. | |||
| User | Lang | Status | Date | Code | 
|---|---|---|---|---|
| No submissions found. | ||||
Solution Hints
- Use a variable to keep track of the account balance.
 - Implement proper validation for all operations.
 - Return appropriate messages for successful and failed operations.
 - Consider adding a transaction history feature.
 - Handle edge cases like maximum withdrawal limits or daily transaction limits.