Using Python. You will write a program that simulates an Automatic Teller Machin
ID: 3910494 • Letter: U
Question
Using Python. You will write a program that simulates an Automatic Teller Machine (ATM). Each user will have access to only a checking account. Design your interface to be similar to what you see on your local ATM.
The purpose of this assignment is to test your object-oriented design abilities.
1. You will need write multiple Python classes to solve this problem. Figure out your nouns, verbs, and the properties of your problem.
2. Since debit card swiping is not possible here, instead ask the user of your program for user ID and a PIN. The user ID will be used to look up the info for the user’s accounts (including the PIN to see if it matches what the user types in).
3. You can program some fake accounts and holders directly into your program, with starting balances, i.e. “Joe Smith” has user id jsmith and a balance of 1350 US dollars. You can program in any number of users you need. Hint: A dictionary is great for this.
4. The user should able to check the balance of, withdraw from, or deposit into their checking account. You can add other actions (transfer between accounts) or accounts (savings, another checking) of your own, as well in addition to the required ones.
5. You should have a main() function that uses any classes you wrote in some sort of interactive loop.
Explanation / Answer
this is the python program to stimulate atm machine print('Welcome to state bank ATM') restart=('Y') chances = 3 balance = 1650 while chances >= 0: userid = int ('please enter you userid: ')) pin = int(input('Please Enter You 4 Digit Pin: ')) if pin == (1234): print('You entered you pin Correctly ') while restart not in ('n','NO','no','N'): print('Please Press 1 For Your Balance ') print('Please Press 2 To Make a Withdrawl ') print('Please Press 3 To Pay in ') print('Please Press 4 To Return Card ') option = int(input('What Would you like to choose?')) if option == 1: print('Your Balance is £',balance,' ') restart = input('Would You you like to go back? ') if restart in ('n','NO','no','N'): print('Thank You') break elif option == 2: option2 = ('y') withdrawl = float(input('How Much Would you like to withdraw? £10/£20/£40/£60/£80/£100 for other enter 1: ')) if withdrawl in [10, 20, 40, 60, 80, 100]: balance = balance - withdrawl print (' Your Balance is now £',balance) restart = input('Would You you like to go back? ') if restart in ('n','NO','no','N'): print('Thank You') break elif withdrawl != [10, 20, 40, 60, 80, 100]: print('Invalid Amount, Please Re-try ') restart = ('y') elif withdrawl == 1: withdrawl = float(input('Please Enter Desired amount:')) elif option == 3: Pay_in = float(input('How Much Would You Like To Pay In? ')) balance = balance + Pay_in print (' Your Balance is now £',balance) restart = input('Would You you like to go back? ') if restart in ('n','NO','no','N'): print('Thank You') break elif option == 4: print('Please wait whilst your card is Returned... ') print('Thank you for you service') break else: print('Please Enter a correct number. ') restart = ('y') elif pin != ('1234'): print('Incorrect Password') chances = chances - 1 if chances == 0: print(' No more tries') break
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.