Skip to content

Commit

Permalink
Merge pull request #423 from ishant025/main
Browse files Browse the repository at this point in the history
Added ATM Interface
  • Loading branch information
UTSAVS26 authored Nov 9, 2024
2 parents f95d303 + 9b5ddbc commit fdf8e2c
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 0 deletions.
57 changes: 57 additions & 0 deletions Beginner_Projects/ATM Interface/ATM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Basic ATM Interface in Python

def display_menu():
print("\nATM Menu")
print("1. Check Balance")
print("2. Deposit Money")
print("3. Withdraw Money")
print("4. Exit")


def check_balance(balance):
print(f"\nYour current balance is: ${balance}")


def deposit_money(balance):
amount = float(input("Enter amount to deposit: $"))
if amount > 0:
balance += amount
print(f"${amount} deposited successfully.")
else:
print("Invalid deposit amount!")
return balance


def withdraw_money(balance):
amount = float(input("Enter amount to withdraw: $"))
if amount > 0 and amount <= balance:
balance -= amount
print(f"${amount} withdrawn successfully.")
elif amount > balance:
print("Insufficient funds!")
else:
print("Invalid withdrawal amount!")
return balance


def atm_interface():
balance = 5000.00 # Initial balance
while True:
display_menu()
choice = input("\nEnter your choice (1-4): ")

if choice == '1':
check_balance(balance)
elif choice == '2':
balance = deposit_money(balance)
elif choice == '3':
balance = withdraw_money(balance)
elif choice == '4':
print("Thank you for using the ATM. Goodbye!")
break
else:
print("Invalid choice! Please try again.")


# Run the ATM interface
atm_interface()
36 changes: 36 additions & 0 deletions Beginner_Projects/ATM Interface/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Basic ATM Interface

### 🎯 **Goal**
Here's a simple Basic ATM Interface project in Python. This project simulates an ATM where users can check their balance, deposit money, withdraw money, and exit.


### 🚀 **How it works**
1. The user is presented with a menu to check balance, deposit money, withdraw money, or exit.
2. Based on the user's input:
* Check Balance: Displays the current balance.
* Deposit Money: Adds the entered amount to the current balance.
* Withdraw Money: Subtracts the entered amount from the balance if there are sufficient funds.
* Exit: Terminates the program.

3. The program continues running until the user chooses to exit.

### **Features**
* Check Balance: See the current account balance.
* Deposit Money: Add money to the account.
* Withdraw Money: Take money from the account if the balance allows.
* Exit: Quit the program.

## 🔧 How to Run

1. Clone the repository and navigate to the project folder:
```bash
git clone <repository-url>
cd <project-folder>
```

2. Install dependencies (if any) and then run the program:
```bash
python3 ATM.py
```
---

0 comments on commit fdf8e2c

Please sign in to comment.