Question

In: Computer Science

Using python, produce code that mimics some ATM transactions: a. A welcome message must be displayed...

Using python, produce code that mimics some ATM transactions:

a. A welcome message must be displayed initially reflecting the appropriate time of day (for example: Good Night, Welcome to Sussex Bank).

b. Assume the user’s account balance is $5375.27.

c. Allow the user to enter a pin number that does not have to be validated: def atm_login(): pin_number = input("Please enter your (4 digit) pin number: ") # display welcome message welcome_message()

d. The message should be followed by a display of menu options: balance enquiry, deposit, withdrawal, and exit (for example: “Enter 1 – To perform a balance enquiry.”) as the user is prompted to make their selection.

NB - Note in some cases you must make certain considerations (for example in the case of a withdrawal – Insufficient funds, the balance is only $$$ and in the case of deposits – Amount must be greater than $0 so to take care of negative deposits)

e. Importantly, this program must be continuous until broken by the option to exit and reflect all current balances with respect to transactions undertaken by user. For example: account balance once initialized as 5375.27, will display 5375.27 for balance enquiry given selection of 1. If followed by withdrawal of 500.00 given selection of 2, new account balance should display 4875.27 and so on… until broken by selection to exit

Solutions

Expert Solution

#import datetime that helps to print greetiing like Good morning,Good Evening and Good Night
import datetime
currentTime = datetime.datetime.now()
currentTime.hour
#Function to print Welcome Message
def welcome_message():
    if currentTime.hour < 12:
     print('Good morning, Welcome to Sussex Bank')
    elif 12 <= currentTime.hour < 18:
       print('Good afternoon, Welcome to Sussex Bank')
    else:
       print('Good Night, Welcome to Sussex Bank')
#Function for the working of ATM like deposit,withdraw and exit
def atm_login():
     pin_number = input("Please enter your (4 digit) pin number: ") #To take the input for pin number
     welcome_message();#Call Welcome Message
     balance = 5375.27#initialize the initial balance with amount $5375.27
     re=('Y')#To  repeat the loop again and again until option is no or choice is 4 i.e. Exit
     while re not in ('n','NO','no','N'):
            print('Please Press 1 For Your Balance Enquiry')
            print('Please Press 2 For Deposit')
            print('Please Press 3 For Withdrawl')
            print('Please Press 4 For Exit')
            option = int(input('What Would you like to choose?'))
            # For Balance Enquiry
            if option == 1:
                print('Your Balance is $',balance)
                re = input('Would You you like to go back? ')
                if re in ('n','NO','no','N'):
                    print('Thank You')
                    break
            #For Depsoit the money    
            elif option == 2:
                dep = float(input('How Much Would You Like Deposit? '))
                if(dep>0):
                    balance = balance + dep
                    print ('Your Balance is now $',balance)
                    re = input('Would You you like to go back? ')
                    if re in ('n','NO','no','N'):
                         print('Thank You')
                         break
                else:
                    print("Amount must be greater than $0")    
            elif option == 3:
                withdrawl = float(input('How Much Would you like to withdraw?'))
                if balance-withdrawl>=0:
                    balance = balance - withdrawl
                    print ('Your Balance is now $',balance)
                    re = input('Would You you like to go back? ')
                    if re in ('n','NO','no','N'):
                        print('Thank You')
                        break
                else :
                    print("Insufficient Funds, The balance is only $ ",balance)
            #Press 4 for Exit option
            elif option == 4:
                print('Please wait while your  ATM card is Returned')
                print('Thank you for you service')
                break        
                
     return 
#Call Atm Login Function
atm_login()    

Related Solutions

(CODE IN PYTHON) Program Input: Your program will display a welcome message to the user and...
(CODE IN PYTHON) Program Input: Your program will display a welcome message to the user and a menu of options for the user to choose from. Welcome to the Email Analyzer program. Please choose from the following options: Upload text data Find by Receiver Download statistics Exit the program Program Options Option 1: Upload Text Data If the user chooses this option, the program will Prompt the user for the file that contains the data. Read in the records in...
Program must use Python 3 Your program must have a welcome message for the user. Your...
Program must use Python 3 Your program must have a welcome message for the user. Your program must have one class called CashRegister. Your program will have an instance method called addItem which takes one parameter for price. The method should also keep track of the number of items in your cart. Your program should have two getter methods. getTotal – returns totalPrice getCount – returns the itemCount of the cart Your program must create an instance of the CashRegister...
fix all errors in code below: PLEASE DO ASAP, THIS IS IN MATLAB %Welcome Message fprintf('****Welcome...
fix all errors in code below: PLEASE DO ASAP, THIS IS IN MATLAB %Welcome Message fprintf('****Welcome to Comida Mexicana De Mentiras****\n'); flag =0; while flag ==1 % Asking the user for the order choice = input('Please enter your order \n 1. Burrito Bowl \n 2.Burrito \n 3. Tacos \n Enter 1 or 2 or 3: ','s'); switch choice case choice==1 % For Burrito Bowl BaseCost = 4; [Protein, PC] = proteinChoice(); [FinalAmount,~]= AmountCalculator(BaseCost,PC); displayMessage("Burrito Bowl",Protein,FinalAmount); case choice==2 end end %...
Instructions from your teacher: Write a Python program that does the following: Displays a welcome message...
Instructions from your teacher: Write a Python program that does the following: Displays a welcome message Prompts a user to enter a number (an integer), and then converts that value from inches to feet. If the user entered a negative number, display an error message telling the user that it was not a "positive " number and prompt the user to enter a number again. Displays the converted value, then " feet" Continue converting the user's valid values until the...
I have the following python code. I get the following message when running it using a...
I have the following python code. I get the following message when running it using a test script which I cannot send here: while textstring[iterator].isspace(): # loop until we get other than space character IndexError: string index out of range. Please find out why and correct the code. def createWords(textstrings): createdWords = [] # empty list for textstring in textstrings: # iterate through each string in trxtstrings iterator = 0 begin = iterator # new begin variable while (iterator <...
#python. Explain code script of each part using comments for the reader. The code script must...
#python. Explain code script of each part using comments for the reader. The code script must work without any errors or bugs. Ball moves in a 2D coordinate system beginning from the original point (0,0). The ball can move upwards, downwards, left and right using x and y coordinates. Code must ask the user for the destination (x2, y2) coordinate point by using the input x2 and y2 and the known current location, code can use the euclidean distance formula...
JavaScript Create a welcome message on your webpage using three variables At least two of the...
JavaScript Create a welcome message on your webpage using three variables At least two of the variables should be concatenated together Use document.write to add a statement about what is your favorite past time? Format the HTML document appropriately with a title, and the correct HTML structure to hold the JavaScript Create an array to share what your favorite color is. The array must have at least three values and be called via the index value Correctly link the JavaScript...
"PYTHON" Write some code " USING PYTHON" to keep reading numbers from the user until the...
"PYTHON" Write some code " USING PYTHON" to keep reading numbers from the user until the users enters a negative number. The program then prints out: a) the sum of all the numbers b) the average of all the numbers c) the max of the numbers d) the min of the numbers Note we did not cover lists (array) so you will not use them in this problem. Finally, ask the user for their name, then print their name as...
The code that creates this program using Python: Your program must include: You will generate a...
The code that creates this program using Python: Your program must include: You will generate a random number between 1 and 100 You will repeatedly ask the user to guess a number between 1 and 100 until they guess the random number. When their guess is too high – let them know When their guess is too low – let them know If they use more than 5 guesses, tell them they lose, you only get 5 guesses. And stop...
Using C++ write a code that mimics a 911 call center where emergency calls are taken...
Using C++ write a code that mimics a 911 call center where emergency calls are taken and routed to the appropriate emergency department. The code will need a class (or classes) that will hold information regarding an emergency. Calls are taken and the operator will use your program to assign values to your class objects to facilitate proper actions. Information recorded includes the address of the emergency, the name of the first responding fireman, officer, or other emergency personnel, an...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT