Math  /  Numbers & Operations

QuestionSTART change=0 quarters=0 dime=0 nickels D pennies=0 Assumptions Change matches 1-99 format. unless exiting. • Calculating in US change. ■ No letters, symbols, decimals or negatives are input. User knows what quarters, dimes, nickels, pennies are. User speaks English. OUTPUT Please Enter Amount of Change (1-99) or ZERO to EXIT."/ INPUT change While change 0 False STOP True While change>=25 -True- change-change-25 quarter-quarter+1 False While change>=10 True- change-change-10 dime-dime+1 False While change>=5 True- change-change-5 nickel nickel+1 False pennies-change OUTPUT "Quarters", quarters "Dimes:", dimes "Nickels:", nickels "Pennies:", pennies quarters=0 dimes = 0 nickels = 0 pennies 0 OUTPUT "Please Enter Amount of Change (1-99) or ZERO to EXIT." INPUT change

Studdy Solution

STEP 1

1. The change amount is between 1 and 99 cents.
2. The calculation is based on US currency: quarters, dimes, nickels, and pennies.
3. Input is a positive integer without letters, symbols, decimals, or negatives.
4. The user understands English and the concept of US coins.

STEP 2

1. Initialize variables.
2. Prompt user for input.
3. Calculate the number of quarters.
4. Calculate the number of dimes.
5. Calculate the number of nickels.
6. Calculate the number of pennies.
7. Output the result.
8. Reset variables and repeat or exit.

STEP 3

Initialize the variables:
change=0,quarters=0,dimes=0,nickels=0,pennies=0\text{change} = 0, \quad \text{quarters} = 0, \quad \text{dimes} = 0, \quad \text{nickels} = 0, \quad \text{pennies} = 0

STEP 4

Prompt the user for input:
OUTPUT: "Please Enter Amount of Change (1-99) or ZERO to EXIT."\text{OUTPUT: "Please Enter Amount of Change (1-99) or ZERO to EXIT."}
INPUT: change\text{INPUT: change}

STEP 5

While change25\text{change} \geq 25, calculate quarters:
While change25:\text{While } \text{change} \geq 25: change=change25\quad \text{change} = \text{change} - 25 quarters=quarters+1\quad \text{quarters} = \text{quarters} + 1

STEP 6

While change10\text{change} \geq 10, calculate dimes:
While change10:\text{While } \text{change} \geq 10: change=change10\quad \text{change} = \text{change} - 10 dimes=dimes+1\quad \text{dimes} = \text{dimes} + 1

STEP 7

While change5\text{change} \geq 5, calculate nickels:
While change5:\text{While } \text{change} \geq 5: change=change5\quad \text{change} = \text{change} - 5 nickels=nickels+1\quad \text{nickels} = \text{nickels} + 1

STEP 8

Calculate pennies:
pennies=change\text{pennies} = \text{change}

STEP 9

Output the result:
OUTPUT: "Quarters:", quarters\text{OUTPUT: "Quarters:", quarters} OUTPUT: "Dimes:", dimes\text{OUTPUT: "Dimes:", dimes} OUTPUT: "Nickels:", nickels\text{OUTPUT: "Nickels:", nickels} OUTPUT: "Pennies:", pennies\text{OUTPUT: "Pennies:", pennies}

STEP 10

Reset variables and prompt for new input or exit:
quarters=0,dimes=0,nickels=0,pennies=0\text{quarters} = 0, \quad \text{dimes} = 0, \quad \text{nickels} = 0, \quad \text{pennies} = 0 OUTPUT: "Please Enter Amount of Change (1-99) or ZERO to EXIT."\text{OUTPUT: "Please Enter Amount of Change (1-99) or ZERO to EXIT."} INPUT: change\text{INPUT: change}

Was this helpful?

Studdy solves anything!

banner

Start learning now

Download Studdy AI Tutor now. Learn with ease and get all help you need to be successful at school.

ParentsInfluencer programContactPolicyTerms
TwitterInstagramFacebookTikTokDiscord