Reference no: EM133234566
For this part of the assignment, take a look at the following pseudocode:
Get a value for change (in cents)
Set pennies to change
Set nickels, dimes, quarters to 0
While (pennies >= 5)
Set nickels to nickels + 1
Set pennies to pennies - 5
While (nickels >= 2)
Set dimes to dimes + 1
Set nickels to nickels - 2
While (dimes >= 5)
Set quarters to quarters + 2
Set dimes to dimes - 5
While (dimes >= 2 and nickels >= 1)
Set quarters to quarters + 1
Set dimes to dimes - 2
Set nickels to nickels -1
Print "Your change is"
Print the value of quarters and "quarters"
Print the value of dimes and "dimes"
Print the value of nickels and "nickels"
Print the value of pennies and "pennies"
1. What is output of this pseudocode for the following amounts? a. 14 b. 25 c. 99
2. What does this pseudocode do? brief explanation in English of the algorithm.
3. This algorithm uses many loops and steps. Is there a less complicated way to write this algorithm? different pseudocode for this algorithm that is shorter and more precise.
4. If you know how much change is in the cash register, how would you make sure that there are enough coins available to provide change for a given amount? short algorithm in pseudocode that asks the user for the number of quarters, dimes, and pennies in the register, as well as for the amount of change requested. If there is sufficient change in the machine, print out "There is enough money to make change." If there is not enough money, print out "There is not enough money to make change." For this problem any amount of change that adds up to the total is acceptable. For example if the register only has 100 pennies, you could make change for 97 cents by giving the customer 97 pennies. You do not have to output how to make the change, only if it is possible.