Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . ( 10 pts . ) Write a function start Up ( frame ) that takes as input a filename that contains the account

image text in transcribed
1 . ( 10 pts . ) Write a function start Up ( frame ) that takes as input a filename that contains the account owner ( user ) information and current account balance . Read the file and store each line into a dictionary . The key is the 4 - digit code ( pin ) . and the value is a list with the user first name , last name and balance ." I balance is a float data type . DO an explicit conversion to float on that list item . Code an exception ( " Cannot get to the file " ) . ` Make the dictionary a global variable in the function and initialize to an empty. dictionary . All other variables in this program must be local variables . The function returns a Boolean value ; for example , if the file was successfully read and the dictionary successfully filled with the file data , then return True ; if the file 25 not successfully opened /' read , return False . 2. 15 pts. ) Write a function getUser! ! that takes no input . - Prompt the user to Enter a pin number . " If the pin is valid , that is , it is 4-digits and is in the dictionary , return ( user , name , True ) where user is the dictionary key and name is the user's first name . If the pin is invalid , print ( " Incorrect pin" ) and return ( None , None , False ) . 3. 15 pts. ) Write a function menu ( name ) that takes as input the user's first name , displays the USEr's name and the menu options :" 1 : Deposit 2 : Withdraw 3 : Check Balance 4: My Data 5: Report 6 : Quit . If the user Enters an invalid value (i.e . not 1 , 2 , 3 , 4 , 5 , 6 ) display the menu options again and* give the user a chance to Enter another value . Once a valid number is entered , the function* should return the number of the chosen option . Code an exception for a non - numeric input* and print " Invalid choice . Try again . " 4 . (10 pts. ) Write a function get Amount ! ) that takes no input . ` 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 . Please 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 . I Stay in the loop until a valid number is entered and return amount

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions