Write a program that prompts the user to enter some number of pennies (1-cent coins), nickels (5-cent
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 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 Answer:
Program include using namespace std void main int pennies0nickels0dimes0qu...View the full answer
Students also viewed these Computer science questions
-
Write a program that prompts the user to enter three strings. Compare the String objects lexicographically and print the middle-valued string. For example, if the three strings were "abcd", "wxyz",...
-
Nine coins are placed in a 3-by-3 matrix with some face up and some face down. You can represent the state of the coins using a 3-by-3 matrix with values 0 (heads) and 1 (tails). Here are some...
-
You will design and implement your own data class. The class will store data that has been read as user input from the keyboard (see Getting Input below), and provide necessary operations. As the...
-
This short exercise demonstrates the similarity and the difference between two ways to acquire plant assets. i (Click the icon to view the cases.) Compare the balances in all the accounts after...
-
Describe the Ribbon.
-
In a water pollution control project, the polluted water is pumped vertically upward 80 ft and then sprayed into the air to increase the oxygen content in the water and to evaporate volatile...
-
Samples of unidirectional Kevlar 49/epoxy and S-glass/epoxy composites are subjected to elevated temperatures in an oven and the resulting thermal strains are measured by using strain gages oriented...
-
The normal capacity of a manufacturing plant is 5,000 units per month. Fixed overhead at this volume is $2,500, and variable overhead is $7,500. Additional data follow: a. Calculate the amount of...
-
A block slides down a ramp that has a coefficient of kinetic friction of 0.2. The ramp makes an angle of 15 degrees with the horizontal. What is the total force that the block feels if its mass is 3...
-
Flora's Fabulous Fontains top product is its Model A. Calculate the minimum replenishment time to build 2500 Model A fountains given the following beginning inventories. Use the following...
-
Write a program that takes an operation followed by two operands and outputs the result. For example: + 100 3.14 * 4 5 Read the operation into a string called operation and use an if-statement to...
-
What are typical sizes for a char, an int, and a double?
-
Lake Company was formed on January 1, 2011, and began constructing a new plant. At the end of 2011, its auditor discovered that all expenditures involving long-term assets had been debited to an...
-
At the all-hands meeting of _____________, the companys executive _____________ were discussed. a. stakeholders, salaries b. stakeholders, salaries c. stakeholders, salarys For the above sentence,...
-
No one likes to give it or receive it, but sometimes criticism is unavoidable, even desirable. Constructive criticism in the workplace is necessary when team members need feedback and managers must...
-
How should candidates handle questions about their weaknesses?
-
When you need service on any of your new equipmentwe will be happy to help you Mr. Greene. For the above sentence, insert any necessary commas. Count the number of commas you add. Write that number...
-
As a financially literate business student, you know about the magic of compound interest. Conventional wisdom and Suze Orman tell us that college grads will have a tidy sum as senior citizens if...
-
Camden and Lily are divorced on March 3, 2015. For financial reasons, however, Lily continues to live in Camden's apartment and receives her support from him. Camden does not claim Lily as a...
-
Find the inverse, if it exists, for the matrix. -1
-
The number of operations executed by algorithms A and B is 40n 2 and 2n 3 , respectively. Determine n 0 such that A is better than B for n n 0 .
-
Give an example of a function that is plotted the same on a log-log scale as it is on a standard scale.
-
Explain why the plot of the function n c is a straight line with slope c on a log-log scale.
-
Explain the concept of Remote Procedure Call (RPC) in IPC? How does it differ from traditional local IPC mechanisms, and what are its advantages in distributed systems?
-
Suppose we use the conventional grade point equivalent given in the following table. GPA Point Table Letter Grade point equivalent grade A 4 B 3 C 2 D 1 F 0 What is Amy's GPA at the end of the...
-
Consider the function y = log(x). A. What is the value of logs(3)?. B. What is the value of log(9)?, 8 C. What is the x-intercept of y = log(x)?. Why? 4 D. Use your answers to help sketch the graph...
Study smarter with the SolutionInn App