ATM Machine and Management System With Python
So Guys we are making an ATM Management System using python. In this project you need to know be familiar with file handling and json files (Java Script Object Notation). We will be using json file to store data using dictionaries.
Working of Program
We will make a conditions for
1)Deposit of amount
2) Withdraw of amount.
3)Check balance
4)Adding an account using pin number only in which we will generate the pin randomly by using random module in range of (1000, 99999) to ensure the pin is secured with 4 to 5 digits.(This condition is not included in it).
5)Exit (To come out of the program)
— — — — — — — — — — — —program files — — — — — — — — — — — —
code in data.json (You will have to add demo data to ensure your program is working)
{
“1111”: { “name”: “samuel”, “age”: 27, “amt”: “52000” },
“1112”: { “name”: “sam”, “age”: 27, “amt”: “304542” },
“1113”: { “name”: “jane”, “age”: 27, “amt”: 50000 },
“1114”: { “name”: “mimi”, “age”: 27, “amt”: 50000 },
“1115”: { “name”: “james”, “age”: 27, “amt”: 50000 },
“1116”: { “name”: “jake”, “age”: 27, “amt”: 50000 }
}
— — — — — — — — — — — -Code in main.py — — — — — — — — — — –
import json
pin=input(“Enter Your Pin”)
while True:
print(“\t\t\twelcome To The SBI”)
with open(‘data.json’,’r+’) as f:
d=json.load(f)
if pin in d:
print(f”welcome {d[pin][‘name’]}”)
print(“1)Check Balance\n2)Withdraw\n3)deposite\n4)Exit”)
choice=input(“Enter your Choice”)
if choice == ‘1’:
print(f”The Remaining amount in Your Account is:- {d[pin][‘amt’]}”)
print(“Thank You”)
elif choice == ‘2’:
width = int(input(“enter the amount you want to widthdraw”))
if width >= int(d[pin][‘amt’]):
print(“insufficient balance”)
print(“Thank You”)
else:
remain=int(d[pin][‘amt’])- width
d[pin][‘amt’] = str(remain)
print(f”widthdrawl successful\nRemaining Amount is:- {d[pin][‘amt’]}”)
print(“Thank You”)
with open(‘data.json’,’w’) as k:
json.dump(d,k)
elif choice == ‘3’:
depo = int(input(“enter the amount you want to deposite”))
drem=depo + int(d[pin][‘amt’])
d[pin][‘amt’] = str(drem)
print(f”Deposite successful\nUpdated Amount is:- {d[pin][‘amt’]}”)
print(“Thank You”)
with open(‘data.json’,’w’) as k:
json.dump(d,k)
elif choice == ‘4’:
exit()
else:
print(“Wrong Input Given Please Choose Correct Option”)
— — — — — — — — — — — — — end of code — — — — — — — — — — — —
:- Working
:-Now for first condition (check balance)
Showed amount is coming from the file data.json
Now for second condition (withdraw of amount)
2. when you give amount less than it had
:-Now to deposit Amount
:- And If you want to exit out of the program
The program has come out of the file path
Note:-(Adding of account through pin) will be added soon Thank You