How to write a python program that simulates an Automatic Teller Machine (ATM)?
ID: 3910053 • Letter: H
Question
How to write a python program that simulates an Automatic Teller Machine (ATM)? (Do not import libraries.)
1. should use multiple Python classes. ( nouns, verbs, and the properties )
2. should ask the user of your program for user ID and a PIN
3. should have some fake accounts and holders directly into the program, with starting balances (using dictionary). The user should able to check the balance of, withdraw from, or deposit into their checking account.
4. should have a main() function that uses any classes you wrote in some sort of interactive loop.
Explanation / Answer
Id did not understand what you want in 4th point. I wrote the plate from. you jast add some code in main for 4th point.
class nouns:
balance = 100
def __init__(self,balance):
self.balance=balance
def setDetail(ID, PIN):
self.ID = ID
self.PIN = PIN
def checkBal():
return balance
def withdraw(money):
balance = balance - money
def deposit(deposite):
balance = balance + deposite
class verbs:
balance = 100
def __init__(self,balance):
self.balance=balance
def setDetail(ID, PIN):
self.ID = ID
self.PIN = PIN
def checkBal():
return balance
def withdraw(money):
balance = balance - money
def deposit(deposite):
balance = balance + deposite
class properties:
balance = 100
def __init__(self,balance):
self.balance=balance
def setDetail(ID, PIN):
self.ID = ID
self.PIN = PIN
def checkBal():
return balance
def withdraw(money):
balance = balance - money
def deposit(deposite):
balance = balance + deposite
if __name__ == "__main__":
acc1 = properties(100)
acc2 = verbs(200)
acc3 = nouns(200)
my_dict = {acc1:100,acc2:100,acc3:200}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.