Construct a program in C++ that exchanges coins for cash like Coinstar that is located in several grocery stores. You will prompt the user to provide you with the total number of pennies, nickels, dimes, and quarters, respectively. You are to determine the total amount of money entered by the user and then output the cash that should be received. For example, if a user enters 50 pennies, 10 dimes, 10 nickels, and 5 quarters, then the user would receive 3 dollars and 1 quarter. Your program output should be as follows:
Your program should have the following format on the output screen:
“Welcome to (your name) Coin Exchanger:
“Please enter the number of pennies:”
>> 50
“Please enter the number of nickels:”
>> 10
“Please enter the number of dimes:”
>>10
“Please enter the number of quarters:”
>>5
The total amount of money due: (Note: Program must output the values from calculating the money)
“The number of dollars:” 3
“The number of quarters:” 1
“The number of dimes:” 0
“The number of nickels:” 0
“The number of pennies:” 0
Here is the code for your problem.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int pennies, nickels, dimes, quarters;
// reading input from user
cout << "Welcome to (your name) Coin Exchanger:" << endl;
cout << "Please enter the number of pennies:\t";
cin >> pennies;
cout << "Please enter the number of nickels:\t";
cin >> nickels;
cout << "Please enter the number of dimes:\t";
cin >> dimes;
cout << "Please enter the number of quarters:\t";
cin >> quarters;
// calculating total
double total = 1.0 * (pennies + nickels * 5 + dimes * 10 + quarters * 25) / 100.0;
// calculating eery value from total and printing
int dollars = floor(total);
cout << "The number of dollars:\t" << dollars << endl;
total -= dollars;
total *= 100;
quarters = floor(total / 25);
cout << "The number of quarters:\t" << quarters << endl;
total -= (quarters * 25);
dimes = floor(total / 10);
cout << "The number of dimes:\t" << dimes << endl;
total -= (dimes * 10);
nickels = floor(total / 5);
cout << "The number of nickels:\t" << nickels << endl;
total -= (nickels * 5);
cout << "The number of pennies:\t" << total << endl;
return 0;
}
Here is the screenshot of the code if the indentation is not clear.

Here is the output of the code.

Hope this helps.
Please rate the answer if you like it.
Do leave a comment.Any suggestion/query is much appreciated.
Construct a program in C++ that exchanges coins for cash like Coinstar that is located in...
(In Python 3) Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 (or less than 0), the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes So...
*Create in Python 3: Change Calculator Create a program that calculates the coins needed to make change for the specified number of cents. Sample Console Output Change Calculator Enter number of cents (0-99): 99 Quarters: 3 Dimes: 2 Nickels: 0 Pennies: 4 Continue? (y/n): y Enter number of cents (0-99): 55 Quarters: 2 Dimes: 0 Nickels: 1 Pennies: 0 Continue? (y/n): n Bye! Specifications The program should display the minimum number of quarters, dimes, nickels, and pennies that one needs...
it c++ coding. please write on atom software.
1. Write a program that converts dollars into coins a. Request a dollar amount as an integer: $5.34 is input as 534 b. Use a constant variable to represent each coin as a fixed value: const int NICKEL 5; c. Use division and the mod function to calculate the number of each coin. Change Calculator Enter dollar amount (as an integer): $534 The equivalent in coins: 21 Quarters 0 Dimes 1 Nickels...
C++
Write a program that helps a young student learn to make change.
Use the random number generator to generate change amounts
between1¢ and 99¢. Ask the user how many quarters, dimes, nickels
and pennies they need to make that amount. Determine whether the
coins specified by the user total the specified amount and give
them feedback on their answer including whether they used the
minimum or optimum number of coins to produce the amount.
Sample output of a program...
Write a C program that calculates exact change. In order to receive full credit, please remember that only int arithmetic is exact, so you’ll need to break up your double into two ints, the one before the decimal point and the one after the decimal point. Another point worth mentioning is that the % operator gives the remainder. In other words, when working with int values, 9 / 5 = 1 whereas 9 % 5 = 4. Keep this in...
C Program that prompts the user to enter a number that represents a pile of pennies. Then, the program should use that input value to distribute the cents over monetary denominations of dollars, half dollars, quarters, dimes, nickels and pennies. Distribute the pennies over the other denominations with Change function : prototype: void Change(int *dollars, int *halfDollars, int *quarters, int *dimes, int *nickels, int *pennies); The function takes a logical input value via its pennies parameter that represents the total...
Write a program called CountCoins.java that prompts the user for the input file name (you can copy the getInputScanner() method given in the ProcessFile assignment) then reads the file. The file contains a series of pairs of tokens, where each pair begins with an integer and is followed by the type of coin, which will be “pennies” (1 cent each), “nickels” (5 cents each), “dimes” (10 cents each), or “quarters” (25 cents each), case-insensitively. Add up the cash values of...
Write a program with total change amount as an integer input, and output the change using the fewest coins, one coin type per line. The coin types are Dollars, Quarters, Dimes, Nickels, and Pennies. Use singular and plural coin names as appropriate, like 1 Penny vs. 2 Pennies. Ex: If the input is: 0 the output is: No change Ex: If the input is: 45 the output is: 1 Quarter 2 Dimes
Write a class encapsulation the concept of coins (Coins java), assuming that coins have the following attributes: a number of quarters, a number of dims, a number of nickels, and a number of pennies. Include a constructor (accept 4 numbers that represent the number of coins for each coin type), mutator and accessot methods, and method tostring. The tostring method should return a string in the following format: Total Value: $5.50 10 quarters, 20 dimes, 19 nickels, and 5 pennies...
In Python 3, Implement a program that directs a cashier how to give change. The program has two inputs: the amount due and the amount received from the customer. Display the dollars, quarters, dimes, nickels, and pennies that the customer should receive in return. In order to avoid roundoff errors, the program user should supply both amounts in pennies, for example 526 instead of 5.26. Enter the amount due in pennies: 828 Enter the amount received from the customer in...