Question: Write a program that prompts the user to enter some number of pennies (1-cent coins), nickels (5-cent coins), dimes (10-cent coins), quarters (25-cent coins), half

Write a program that prompts the user to enter some number of pennies (1-cent coins), nickels (5-cent coins), dimes (10-cent coins), quarters (25-cent coins), half dollars (50-cent coins), and one-dollar coins (100-cent coins). Query the user separately for the number of each size coin, e.g., “How many pennies do you have?” Then your program should print out something like this:

You have 23 pennies.
You have 17 nickels.
You have 14 dimes.
You have 7 quarters.
You have 3 half dollars.

The value of all of your coins is 573 cents. Make some improvements: if only one of a coin is reported, make the output grammatically correct, e.g., 14 dimes and 1 dime (not 1 dimes). Also, report the sum in dollars and cents, i.e., $5.73 instead of 573 cents.

Step by Step Solution

3.32 Rating (167 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Program include using namespace std void main int pennies0nickels0dimes0qu... View full answer

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

Document Format (2 attachments)

PDF file Icon

2083_61d6ac34462fb_852641.pdf

180 KBs PDF File

Word file Icon

2083_61d6ac34462fb_852641.docx

120 KBs Word File

Students Have Also Explored These Related Programming Principles and Practice Questions!