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.
-
*P6.11 (LO 6) Terzi Department Store uses the retail inventory method to estimate its monthly ending Compute ending inventory using retail inventories. The following information is available for two...
-
_________________ reserves allow for future situations that are unpredictable. a. Contingency b. Financial c. Management d. Baseline LO.1
-
In Chapter 7, you developed a use case diagram, an activity diagram, and a system sequence diagram for the use cases Rent movies and Return movies. In Chapter 11 you developed a first-cut DCD and...
-
Exercise 12-6 Managing a Constrained Resource [LO12-6) Portsmouth Company makes upholstered furniture. Its only variable cost is direct materials. The demand for the company's products far exceeds...
-
A firm has a profit margin of 3% and an equity multiplier of 1.9. Its sales are $150 million, and it has total assets of $60 million. What is its ROE?
-
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?
-
For each of the following, compute the present value: Present Value Years 17 9 23 35 Interest Rate 9% 7 13 21 Future Value $ 16,832 48,318 886,073 550, 164
-
Door-to-Door Marketing.A small nonprofit organization is planning a door-to-door marketing campaign to sell Christmas wrapping and gifts. They plan to visit 10 homes. Consultants have estimated that...
-
OTHELLO - ACT III QUESTION 1 What are the clowns and musicians doing in front of the castle? QUESTION 2 For what purpose is Cassio there? QUESTION 3 Cassio asks Iago to ask whom to make an...
-
How does the power of the situation affect how we think, feel, and behave, not just in the lab but in our day-to-day lives? What does social psychological research have to offer as we understand how...
-
[Replace this text, including the brackets, with an introduction of the claim and the scenario of this hypothesis test. State your null and alternative hypothesis in sentence format. State your null...
-
Explain how drug addiction affects the brain. Does the childhood environment affect their likelihood of becoming addicted? Give evidence of how it does or does not affect this. Please compare two...
-
Evaluate each of the following. (-2) 4
-
Find a polar equation for the curve represented by the given Cartesian equation. 4y 2 = x
-
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.
-
On an average day, a company writes checks totaling $1,500. These checks take 7 days to clear. The company receives checks totaling $1,800. These checks take 4 days to clear. The cost of debt is 9%....
-
Olds Company declares Chapter 7 bankruptcy. The following are the book values of the asset and liability accounts at that time. A bankruptcy expert estimates that administrative expense will total $...
-
As the representative of the local accounting club, you have been asked by the dean to help her understand the costs of the different degrees offered at the school. You decide to use an...
Study smarter with the SolutionInn App