Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need an updated answer for these questions so please don't copy from the previous answer of these questions, i hope you can help me

I need an updated answer for these questions so please don't copy from the previous answer of these questions, i hope you can help me thanks.

1image text in transcribedimage text in transcribedimage text in transcribed

Design, using an IPO chart, a flow chart, pseudocode, or any reasonable combination of these techniques, a module called checkGuess that accepts 2 string inputs. The first input will be the user's guess and the second input will be a secret letter chosen at random. No Python code is expected or required for this solution. If the first input is alphabetically after the second input, return a value of 1. If the first input is alphabetically before the second input, return a value of -1. If the two inputs are equal return a value of 0 . Do not take upper or lower case into consideration. Use your module as part of a design, using an IPO chart, flow chart, pseudocode, or any reasonable combination of these techniques, to solve the following problem. Call your module using pseudocode like CALL checkGuess( op1, op2 ) AS val. Your pseudocode should use your own variable names instead of op1, op2, and val. Be sure to document any assumptions you make along the way in your design. Problem: A person is playing a guessing game in which they have 3 guesses to figure out the computer's secret letter which will be between A and Z inclusive. If they guess the letter correctly on the first guess the program should stop making them guess and they should get 26 points. If they guess the letter correctly on the second guess the program should stop making them guess and they should get 13 points. If they guess the letter correctly on the third guess, they should get 7 points. After an incorrect guess tell the user if their guess was too high or too low based on the results of checkGuess. If they fail to guess the letter correctly after 3 guesses they get 0 points. Be sure to tell them what score they got. Question 2: Writing code from a design. [50\%] Write valid Python code to implement the design shown in the following flow chart. The problem is provided to help make the flow chart clearer, but you are not expected to use it in any way. In order to calculate the amount that the customer needs to pay, include the code import random as the first line of your file and then use amount = random.randint 0,20) + round ( random.randint (0,100)/100,2 ) to calculate the amount. Completely test your code - there will be a major penalty if the code submitted cannot be run by your professor. In order to test your code, set amount to your test value after it is set by the random line. Create comments in your source code to state what values you used to test your program. A single test will not be sufficient to correctly test this program, so do not be concerned if you believe that you need to go through your program more than 1 time in order to completely test it. For example: \begin{tabular}{l} \hline R. "untitled* \\ Elle Edit Format Bun Qptions Window Help \\ \hline import random \\ * I Sample Student, 12345678 , certify that this work is my own effort and that I \\ amount = random, randint (0,20)+ round ( random. randint (0,100)/100,2) \\ F Test values \\ ; Setting amount here will overwrite the value above \\ amount =22?2? \end{tabular} Problem: A person is at a store and you have just processed their purchase. After you tell them the amount that they owe for their purchase they will hand you some money. If the amount given is the exact amount, then you should tell them that no change is owed. Otherwise, you should calculate the number of each denomination to give them the change. The denominations available are dollars (1.00), quarters (0.25), dimes (0.10), and nickels (0.05). Since Canada no longer has a penny the change should be rounded up to the nearest nickel. Once you have calculated the change you should tell the person how much change you have given them. In order to keep your customer happy, you should always give them the fewest coins possible, do not simply give them back all their change in nickels. Note that some of the steps in the flow chart will require you to think about how to get Python to perform the calculation. There is no best way to do it that will Any valid, working Python code that correctly calculates the totals will be accepted. Do not, however, remove any of the conditional statements. There are two conditional blocks in the flow chart and there should be two in your solution since we are trying to practice writing them. You are expected to use meaningful variable names and comment any code you feel requires explanation

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

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions