Question: explain your code using comment. Write valid Python code to implement the design shown in the following flow chart. The problem is provided to help

 explain your code using comment. Write valid Python code to implement

explain your code using comment.

the design shown in the following flow chart. The problem is provided

to help make the flow chart clearer, but you are not expected

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 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 back in their 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 earn more marks. 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. Start CALCULATE amount of transaction AS amount SHOW amount TO screen GET amount of payment FROM keyboard AS payment ASSUME payment >= amount CALCULATE change = payment-amount NO SHOW "No change owed" IS change >07 YES CALCULATE dollars owed AS a CALCULATE change = change - a SET d=0, q=0, i=0,n=0 YES is change > 0? CALCULATE quarters owed AS a CALCULATE dimes owed AS i CALCULATE nickels owed AS CALCULATE change = change- (q* 0.25 +i* 0.10+n* 0.05) CALCULATE n=n-round(change 2.1)*10 NO SHOW "You got a dollars, q quarters, i dimes, and n nickels back in change." END

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 Databases Questions!