Question: You are to write a Python program that simulates a very simple ATM machine. An account owner ( user ) should be able to enter

You are to write a Python program that simulates a very simple ATM machine. An account owner (user) should be able to enter a pin number and select from a menu of transactions: Deposit, Withdraw, Balance and Quit. You are to assume that the user has only one account on which these transactions can be performed. This account is associated with the users pin number. The ATM should properly and regularly communicate with the user. The ATM should get information on current accounts from a file (accounts.csv). This file is posted with the assignment. Each line of the file contains a 4-digit code (pin), first name, last name, and the account balance. Partial contents of accounts.csv file follows:
- Inside a loop, prompt the user for an amount to be deposited or withdrawn; at this point it does not matter which it is. The amount must be converted to float. If the amount is negative, print ' Negative amount. Try again'.
- Code an exception (' Invalid amount. Use digits only.). An interruption would be caused if the user enters a string instead of a numeric value, or hits the enter key without entering anything.
- Stay in the loop until a valid number is entered and return amount.
6.(5 pts.) Write a function deposit(pin, d) that takes as input the user's pin number and the dictionary. The function calls verifyAmount 0, calculates the new balance and updates the dictionary. The function does not return a value, but it should have a return statement.
7.(10 pts.) Write a function withdraw(pin, d) that takes as input the user's pin number and the dictionary. The function calls verifyAmount(0. If the amount to be withdrawn is greater than the balance print ('Insufficient funds to complete the transaction'). The user should be prompted to enter a new amount, until the amount entered is less than the balance or 0. The function uses the balance in the dictionary to calculate the new balance. The balance is updated in the dictionary. This function does not return a value, but it should have a return statement.
8.(5 pts.) Write a function balance (pin, d) that takes as input the user's pin number and dictionary and returns the user's balance from the dictionary.
9.(5 pts.) Write a function quit(pin, d) that takes as input the user's pin number and dictionary. The user is prompted as to whether or not she wishes to leave the transaction. If she does ('\( y \)'), then call receipt(pin, d) to print a receipt for the session; (see sample below). If she does not want to leave ('\( n \)') the application, then return the user's response.
10.(5 pts.) Write a function receipt(pin, d) that takes as input the user's pin number and dictionary. The function does not return a value but it should have a return statement. The receipt should contain the name of the bank branch and address, the current date, the account user's full name, the available balance formatted as currency and the message 'thanks for using the ABC Banking system'. Use the sample below for the layout and verbiage. ```
ABC Bank Branch Receipt
123 Bank St.
Anytown, USA
Date: 2024-10-22
Name: Daffy Duck
Available Balance: $234.00
Thank you for using the ABC Banking System
'Goodbye'
```
You are to write a Python program that simulates

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!