Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Part 2 Reading Pseudocode For this part of the assignment, take a look at the fo

ID: 3882949 • Letter: P

Question

Part 2 Reading Pseudocode 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 nickels1 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 - 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"

Explanation / Answer

3. Shorter Pseudocode for the algorithm:

Get a value for change (in cents)
Set pennies to change
Set quarters to quotient of pennies / 25
Set pennies to pennies - (25 * quarters) (Since 25 pennies = 1 quarter)
Set dimes to quotient of pennies / 10
Set pennies to pennies - (10 * dimes) (Since 10 pennies = 1 dime)
Set nickels to quotient of pennies / 5
Set pennies to pennies - (5 * nickels) (Since 5 pennies = 1 nickel)

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"

4.

Get a value for quarters in cash register

Get a value for dimes in cash register

Get a value for nickels in cash register

Get a value for pennies in cash register

Get a value for change requested (in cents)

Set quarters to quarters

Set dimes to dimes

Set nickels to nickels

Set pennies to pennies

Set change_requested to change

Set change_in_cash_register to pennies (convert the change_in_cash_register to pennies)

Set change_in_cash_register = change_in_cash_register + (25 * quarters) (Since 25 pennies = 1 quarter)

Set change_in_cash_register = change_in_cash_register + (10 * dimes) (Since 10 pennies = 1 dime)

Set change_in_cash_register = change_in_cash_register + (5 * nickels) (Since 5 pennies = 1 nickel)

if (change_requested <= change_in_cash_register)

Print "There is enough money to make change"

else

Print "There is not enough money to make change"

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote