REQUIREMENTS: You will define a new function to encrypt the user's password for their account, accepting...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
REQUIREMENTS: You will define a new function to encrypt the user's password for their account, accepting one argument, the password string in plaintext, and returning the encrypted password string. You will use the substitution cipher called the Caesar cipher to replace each letter or digit by three positions down. For example, the uppercase letter 'A' would be replaced by the uppercase letter 'D', the uppercase letter 'B' would be replaced by the uppercase letter 'E', and so on. However, note that the uppercase letter 'X' would be replaced by the uppercase letter 'A', since it would wrap around the alphabet, and so forth. Similarly, the lowercase 'a' would be replaced by a lowercase 'd', and so forth, also wrapping around the alphabet for the lowercase letters 'x', 'y', and 'z'. Also, the digit '0' would be replaced by the digit '3', the digit '1' would be replaced by the digit '4', and so forth. Also, the digit '7' would be replaced by the digit '0', since it would wrap around to the start of the digits, and so forth. Any character that is not an upper- or lowercase letter or digit, such as the '@' or '%', should not be modified and left as is. o To help with the encryption, you are recommended to make use of their ASCII values. For example, the uppercase 'A' starts the uppercase letters and has an ASCII value of 65. To do the shift hree characters, you can make use of the following formula (modifying to fit your needs) for uppercase letters: c = (m + 3- 65) % 26 + 65 where c is the ciphertext and m is the plaintext uppercase letter. This formula takes into account the wrap around that would occur for the last three uppercase letters, but you should also make use of the chr () and ord () functions as necessary. You will have to modify this formula for the lowercase letters and digits as appropriate. You will define a new function to deposit an amount to the account balance, accepting one argument, the deposit amount as a floating-point number. In this function, you will simply add the deposit amount to the current balance in the account and print the new balance. There is no return statement for this function. You will define a new function to withdraw an amount from the account balance, accepting one argument, the withdrawal amount as a floating-point number. In this function, if the current balance in the account is greater than or equal to the withdrawal amount, you will deduct the amount from the balance and print the new balance. If the amount is greater than the current balance in the account, you will print a message that the transaction is denied due to insufficient funds. There is no return statement for this function. As with all homework programs in this course, your program's output initially displays the department and course number, your name, your EUID, and your email address. This means that your program will print this information to the terminal (see SAMPLE OUTPUT). You will use a dictionary (i.e., Python dictionary) to hold the account information that includes the user ID, password, and account balance. You will also keep track of whether or not the user has logged in (i.e., been authenticated) to their account as services may not be accessed until the user has logged in (except a hidden option described below). After the account is initially opened, the user will not be logged in to their account. Before displaying the menu option, you will allow the user to "open" their account with the following: 1. You will prompt for and read in a new user ID and password for the new account as a string for each of these values. Before storing the password in the dictionary, you will first encrypt the password using the user-defined encryption function defined above. 2. You will then prompt for and read in the initial balance associated with the new account as a floating-point number. Inside a loop, your program will continuously display a menu with the following account options until the user decides to exit/logout of the program: Select a service: 1. Login to Account. 2. Deposit to Account 3. Withdraw from Account 4. Print Balance. 5. Change Password. 6. Exit/Logout You may assume that the user enters an integer in response to this menu, although the integer may be out of range. If the user selection is not valid, you will print out an appropriate message that the selection is invalid and continue to display the menu and re-prompt the user to enter a value until a valid value is entered. User menu selection input: 1. Upon selection of the Login to Account option, you will prompt for and read in the user ID and password as a string for each of these values. Then, you will compare the user ID and password just entered with the values stored in the account (i.e., in the dictionary), remembering that the stored password has been encrypted. If the user ID and password match, you will then mark the user as authenticated (i.e., logged in) and print an appropriate status message. If these values do not match, you will print out an appropriate message that the user was not able to be logged in due to an invalid user ID or password. 2. Upon selection of the Deposit to Account option, if the user has been authenticated, you will prompt for and read in the deposit amount as a floating-point number and then call the deposit function defined above to deposit the amount just entered. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 3. Upon selection of the Withdraw from Account option, if the user has been authenticated, you will prompt for and read in the withdrawal amount as a floating-point number and then call the withdraw function defined above to withdraw the amount just entered. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 4. Upon selection of the Print Balance option, if the user has been authenticated, you will simply print out the current account balance for the user's account. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 5. Upon selection of the Change Password option, if the user has been authenticated, you will prompt for and read in the new password as a string and then encrypt and update the encrypted password stored in the account. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 6. Upon selection of the Exit/Logout option, you will print out an appropriate message that the user has logged out of their account and exit the loop/program. 9. There is a hidden number '9' option that is not displayed in the menu, but prints out the account information in the dictionary whether the user is logged in or not. All balances should be properly displayed, formatted to two decimal places. Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. This means that in addition to the program printing your information to the terminal (see SAMPLE OUTPUT), some of this information will also appear in the code in the comments as well. Your program source code should be named "assignment2.py", without the quotes. Your program will be graded based largely on whether it works correctly on our Linux CSE machines (e.g., cse01, cse02, ..., cse06), so you should make sure that your program runs on a CSE machine. This is an individual programming assignment that must be the sole work of the individual student. You may assume that all input will be of the appropriate data type, but may be out of range. You shall use techniques and concepts discussed in class - you are not to use any items specifically not recommended in this class. DESIGN (ALGORITHM): On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a "recipe" for someone else to follow. Continue to refine your "recipe" until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output. You should attempt to solve the problem by hand first (using a calculator as needed) to work out what the answer should be for a few sets of inputs. Type these steps and calculations into a document (i.e., Word, text, PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and easily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results. SAMPLE OUTPUT (input shown in bold): $ python3 assignment2.py Computer Science and Engineering CSCE 1035 Computer Programming I Student Name EUID euid@my.unt.edu Enter new user ID : wdj0017 Enter password : P@55W0rd$ Enter initial balance: $100.27 I I + REQUIREMENTS: You will define a new function to encrypt the user's password for their account, accepting one argument, the password string in plaintext, and returning the encrypted password string. You will use the substitution cipher called the Caesar cipher to replace each letter or digit by three positions down. For example, the uppercase letter 'A' would be replaced by the uppercase letter 'D', the uppercase letter 'B' would be replaced by the uppercase letter 'E', and so on. However, note that the uppercase letter 'X' would be replaced by the uppercase letter 'A', since it would wrap around the alphabet, and so forth. Similarly, the lowercase 'a' would be replaced by a lowercase 'd', and so forth, also wrapping around the alphabet for the lowercase letters 'x', 'y', and 'z'. Also, the digit '0' would be replaced by the digit '3', the digit '1' would be replaced by the digit '4', and so forth. Also, the digit '7' would be replaced by the digit '0', since it would wrap around to the start of the digits, and so forth. Any character that is not an upper- or lowercase letter or digit, such as the '@' or '%', should not be modified and left as is. o To help with the encryption, you are recommended to make use of their ASCII values. For example, the uppercase 'A' starts the uppercase letters and has an ASCII value of 65. To do the shift hree characters, you can make use of the following formula (modifying to fit your needs) for uppercase letters: c = (m + 3- 65) % 26 + 65 where c is the ciphertext and m is the plaintext uppercase letter. This formula takes into account the wrap around that would occur for the last three uppercase letters, but you should also make use of the chr () and ord () functions as necessary. You will have to modify this formula for the lowercase letters and digits as appropriate. You will define a new function to deposit an amount to the account balance, accepting one argument, the deposit amount as a floating-point number. In this function, you will simply add the deposit amount to the current balance in the account and print the new balance. There is no return statement for this function. You will define a new function to withdraw an amount from the account balance, accepting one argument, the withdrawal amount as a floating-point number. In this function, if the current balance in the account is greater than or equal to the withdrawal amount, you will deduct the amount from the balance and print the new balance. If the amount is greater than the current balance in the account, you will print a message that the transaction is denied due to insufficient funds. There is no return statement for this function. REQUIREMENTS: You will define a new function to encrypt the user's password for their account, accepting one argument, the password string in plaintext, and returning the encrypted password string. You will use the substitution cipher called the Caesar cipher to replace each letter or digit by three positions down. For example, the uppercase letter 'A' would be replaced by the uppercase letter 'D', the uppercase letter 'B' would be replaced by the uppercase letter 'E', and so on. However, note that the uppercase letter 'X' would be replaced by the uppercase letter 'A', since it would wrap around the alphabet, and so forth. Similarly, the lowercase 'a' would be replaced by a lowercase 'd', and so forth, also wrapping around the alphabet for the lowercase letters 'x', 'y', and 'z'. Also, the digit '0' would be replaced by the digit '3', the digit '1' would be replaced by the digit '4', and so forth. Also, the digit '7' would be replaced by the digit '0', since it would wrap around to the start of the digits, and so forth. Any character that is not an upper- or lowercase letter or digit, such as the '@' or '%', should not be modified and left as is. o To help with the encryption, you are recommended to make use of their ASCII values. For example, the uppercase 'A' starts the uppercase letters and has an ASCII value of 65. To do the shift hree characters, you can make use of the following formula (modifying to fit your needs) for uppercase letters: c = (m + 3- 65) % 26 + 65 where c is the ciphertext and m is the plaintext uppercase letter. This formula takes into account the wrap around that would occur for the last three uppercase letters, but you should also make use of the chr () and ord () functions as necessary. You will have to modify this formula for the lowercase letters and digits as appropriate. You will define a new function to deposit an amount to the account balance, accepting one argument, the deposit amount as a floating-point number. In this function, you will simply add the deposit amount to the current balance in the account and print the new balance. There is no return statement for this function. You will define a new function to withdraw an amount from the account balance, accepting one argument, the withdrawal amount as a floating-point number. In this function, if the current balance in the account is greater than or equal to the withdrawal amount, you will deduct the amount from the balance and print the new balance. If the amount is greater than the current balance in the account, you will print a message that the transaction is denied due to insufficient funds. There is no return statement for this function. As with all homework programs in this course, your program's output initially displays the department and course number, your name, your EUID, and your email address. This means that your program will print this information to the terminal (see SAMPLE OUTPUT). You will use a dictionary (i.e., Python dictionary) to hold the account information that includes the user ID, password, and account balance. You will also keep track of whether or not the user has logged in (i.e., been authenticated) to their account as services may not be accessed until the user has logged in (except a hidden option described below). After the account is initially opened, the user will not be logged in to their account. Before displaying the menu option, you will allow the user to "open" their account with the following: 1. You will prompt for and read in a new user ID and password for the new account as a string for each of these values. Before storing the password in the dictionary, you will first encrypt the password using the user-defined encryption function defined above. 2. You will then prompt for and read in the initial balance associated with the new account as a floating-point number. Inside a loop, your program will continuously display a menu with the following account options until the user decides to exit/logout of the program: Select a service: 1. Login to Account. 2. Deposit to Account 3. Withdraw from Account 4. Print Balance. 5. Change Password. 6. Exit/Logout You may assume that the user enters an integer in response to this menu, although the integer may be out of range. If the user selection is not valid, you will print out an appropriate message that the selection is invalid and continue to display the menu and re-prompt the user to enter a value until a valid value is entered. User menu selection input: 1. Upon selection of the Login to Account option, you will prompt for and read in the user ID and password as a string for each of these values. Then, you will compare the user ID and password just entered with the values stored in the account (i.e., in the dictionary), remembering that the stored password has been encrypted. If the user ID and password match, you will then mark the user as authenticated (i.e., logged in) and print an appropriate status message. If these values do not match, you will print out an appropriate message that the user was not able to be logged in due to an invalid user ID or password. As with all homework programs in this course, your program's output initially displays the department and course number, your name, your EUID, and your email address. This means that your program will print this information to the terminal (see SAMPLE OUTPUT). You will use a dictionary (i.e., Python dictionary) to hold the account information that includes the user ID, password, and account balance. You will also keep track of whether or not the user has logged in (i.e., been authenticated) to their account as services may not be accessed until the user has logged in (except a hidden option described below). After the account is initially opened, the user will not be logged in to their account. Before displaying the menu option, you will allow the user to "open" their account with the following: 1. You will prompt for and read in a new user ID and password for the new account as a string for each of these values. Before storing the password in the dictionary, you will first encrypt the password using the user-defined encryption function defined above. 2. You will then prompt for and read in the initial balance associated with the new account as a floating-point number. Inside a loop, your program will continuously display a menu with the following account options until the user decides to exit/logout of the program: Select a service: 1. Login to Account. 2. Deposit to Account 3. Withdraw from Account 4. Print Balance. 5. Change Password. 6. Exit/Logout You may assume that the user enters an integer in response to this menu, although the integer may be out of range. If the user selection is not valid, you will print out an appropriate message that the selection is invalid and continue to display the menu and re-prompt the user to enter a value until a valid value is entered. User menu selection input: 1. Upon selection of the Login to Account option, you will prompt for and read in the user ID and password as a string for each of these values. Then, you will compare the user ID and password just entered with the values stored in the account (i.e., in the dictionary), remembering that the stored password has been encrypted. If the user ID and password match, you will then mark the user as authenticated (i.e., logged in) and print an appropriate status message. If these values do not match, you will print out an appropriate message that the user was not able to be logged in due to an invalid user ID or password. 2. Upon selection of the Deposit to Account option, if the user has been authenticated, you will prompt for and read in the deposit amount as a floating-point number and then call the deposit function defined above to deposit the amount just entered. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 3. Upon selection of the Withdraw from Account option, if the user has been authenticated, you will prompt for and read in the withdrawal amount as a floating-point number and then call the withdraw function defined above to withdraw the amount just entered. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 4. Upon selection of the Print Balance option, if the user has been authenticated, you will simply print out the current account balance for the user's account. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 5. Upon selection of the Change Password option, if the user has been authenticated, you will prompt for and read in the new password as a string and then encrypt and update the encrypted password stored in the account. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 6. Upon selection of the Exit/Logout option, you will print out an appropriate message that the user has logged out of their account and exit the loop/program. 9. There is a hidden number '9' option that is not displayed in the menu, but prints out the account information in the dictionary whether the user is logged in or not. All balances should be properly displayed, formatted to two decimal places. Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. This means that in addition to the program printing your information to the terminal (see SAMPLE OUTPUT), some of this information will also appear in the code in the comments as well. Your program source code should be named "assignment2.py", without the quotes. Your program will be graded based largely on whether it works correctly on our Linux CSE machines (e.g., cse01, cse02, ..., cse06), so you should make sure that your program runs on a CSE machine. This is an individual programming assignment that must be the sole work of the individual student. You may assume that all input will be of the appropriate data type, but may be out of range. You shall use techniques and concepts discussed in class - you are not to use any items specifically not recommended in this class. 2. Upon selection of the Deposit to Account option, if the user has been authenticated, you will prompt for and read in the deposit amount as a floating-point number and then call the deposit function defined above to deposit the amount just entered. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 3. Upon selection of the Withdraw from Account option, if the user has been authenticated, you will prompt for and read in the withdrawal amount as a floating-point number and then call the withdraw function defined above to withdraw the amount just entered. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 4. Upon selection of the Print Balance option, if the user has been authenticated, you will simply print out the current account balance for the user's account. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 5. Upon selection of the Change Password option, if the user has been authenticated, you will prompt for and read in the new password as a string and then encrypt and update the encrypted password stored in the account. If the user has not been authenticated, you will print out an appropriate message that their transaction could not be performed since the user is not logged in. 6. Upon selection of the Exit/Logout option, you will print out an appropriate message that the user has logged out of their account and exit the loop/program. 9. There is a hidden number '9' option that is not displayed in the menu, but prints out the account information in the dictionary whether the user is logged in or not. All balances should be properly displayed, formatted to two decimal places. Your code should be well documented in terms of comments. For example, good comments in general consist of a header (with your name, course section, date, and brief description), comments for each variable, and commented blocks of code. This means that in addition to the program printing your information to the terminal (see SAMPLE OUTPUT), some of this information will also appear in the code in the comments as well. Your program source code should be named "assignment2.py", without the quotes. Your program will be graded based largely on whether it works correctly on our Linux CSE machines (e.g., cse01, cse02, ..., cse06), so you should make sure that your program runs on a CSE machine. This is an individual programming assignment that must be the sole work of the individual student. You may assume that all input will be of the appropriate data type, but may be out of range. You shall use techniques and concepts discussed in class - you are not to use any items specifically not recommended in this class. DESIGN (ALGORITHM): On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a "recipe" for someone else to follow. Continue to refine your "recipe" until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output. You should attempt to solve the problem by hand first (using a calculator as needed) to work out what the answer should be for a few sets of inputs. Type these steps and calculations into a document (i.e., Word, text, PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and easily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results. SAMPLE OUTPUT (input shown in bold): $ python3 assignment2.py Computer Science and Engineering CSCE 1035 Computer Programming I Student Name EUID euid@my.unt.edu Enter new user ID : wdj0017 Enter password : P@55W0rd$ Enter initial balance: $100.27 I I + DESIGN (ALGORITHM): On a piece of paper (or word processor), write down the algorithm, or sequence of steps, that you will use to solve the problem. You may think of this as a "recipe" for someone else to follow. Continue to refine your "recipe" until it is clear and deterministically solves the problem. Be sure to include the steps for prompting for input, performing calculations, and displaying output. You should attempt to solve the problem by hand first (using a calculator as needed) to work out what the answer should be for a few sets of inputs. Type these steps and calculations into a document (i.e., Word, text, PDF) that will be submitted along with your source code. Note that if you do any work by hand, images (such as pictures) may be used, but they must be clear and easily readable. This document shall contain both the algorithm and any supporting hand-calculations you used in verifying your results. SAMPLE OUTPUT (input shown in bold): $ python3 assignment2.py Computer Science and Engineering CSCE 1035 Computer Programming I Student Name EUID euid@my.unt.edu Enter new user ID : wdj0017 Enter password : P@55W0rd$ Enter initial balance: $100.27 I I +
Expert Answer:
Answer rating: 100% (QA)
Based on the assignment requirements provided in the images you need to create a Python program that simulates a banking system with user accounts that can perform various operations such as depositin... View the full answer
Related Book For
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba
Posted Date:
Students also viewed these programming questions
-
Which of the following is a partial measure of productivity? A) Output/Materials B) Output/(Labor + Capital + Energy) C) Output/ All resources used D) Output/Inputs E) All of the above
-
A billboard at the top of a building is being illuminated by a projection light (L) that is 103 feet from the base of the building as shown in the figure. Determine how tall the billboard if its...
-
The North West Company Inc., a leading retailer to underserved rural and urban areas in hard-to-reach markets, reported the following selected information as at January 31, 2015 (in thousands):...
-
Two dice are rolled. Find the probabilities in parts be. Use the sample space given in Example 4.3 (p. 175). a. Why is the set (2, 3, 4, .. , 12) not a useful sample space? b. P(white die is an odd...
-
Review the Ethical Focus feature, Whats in a Name? Youre Hired... or Not!, and use Bruners model of the perceptual process to explain why job applicants with ethnic-sounding names are less likely to...
-
Tracy Brigham has recently been promoted to production manager, and so he has just started to receive various managerial reports. One of the reports he has received is the production cost report that...
-
Different types of investments carry different risk levels. Based on what you learned in the unit, are you drawn toward higher-risk (and potentially higher reward) investments or safer, more...
-
1. How do you interpret Netflix's adjustment for accrued expressions and other liabilities (198,183) in its operating cash flows? 2. How do you interpret Netflix's adjustment for deferred revenue...
-
A 20 year bond pays semi-annual coupons. The face amount of the bond is $1,000 and is the same as the redemption amount. The bond is sold at a market price of $975 and at that price the bond provides...
-
The PE ratio for the Agricultural Products industry is 18.5x. Based on Monsanto's most recent earnings, what is the expected price of Monsanto stock? Stock Portfolio Name Shares Price 7/1/2014 Price...
-
As assistant to the CFO of Boulder Inc., you must estimate the Year 1 cash flow for a project with the following data. Under the new tax law, the equipment used in the project is eligible for 100%...
-
Solve this Java problem: develop a program containing a while-loop. Prompt a user for quiz scores. The loop will continue prompting for numbers until the user types the word "stop". The loop should:...
-
Make a cross tab that shows the number of units sold by region and item description. Store and Regional Sales Databas ID Store No. Sales Region Item No. Item Description Unit Price Units Sold Sales...
-
The geometric average of -12%, 20%, and 25% is _________.
-
[a] Two foam blocks, each with a charge of 19 micro coulombs (1 C = 10-6 C), are both held in place 19 cm apart in the east-west direction. A foam ball with a charge 49 C is placed 55 cm north of the...
-
Quality of Life Indexes: Every year, various magazines publish lists of The 10 Best Cities for Living" or The 10Worst Cities. These lists are constructed by magazines weighting various factors such...
-
In Chapter 22, we worked with models in which high and low cost customers compete for insurance. Consider the level x of health insurance that consumers might choose to buy, with higher levels of x...
-
In Chapter 22, we briefly discussed the signaling role of educationi.e. the fact that part of the reason many people get more education is not to learn more but rather to signal high productivity to...
-
Nestls financial statements are presented in Appendix B. Financial statements of Delfi Limited are presented in Appendix C. Instructions Refer to the financial statements and answer the following...
-
Writing Financial statement information about four different companies is as follows. Instructions a. Determine the missing amounts. (Hint: For example, to solve for (a), Assets Liabilities = Equity...
-
The financial statements of TSMC are presented in Appendix A. The complete annual report, including the notes to the financial statements, is available at the companys website. Instructions Refer to...
Study smarter with the SolutionInn App