Question
Write a C++ program that computes and outputs the amount of change returned by a vending machine. The user will enter two numbers: the price
Write a C++ program that computes and outputs the amount of change returned by a vending machine. The user will enter two numbers: the price of the selected item and the amount paid by the customer. Both numbers should be a whole number of cents. For ex- ample, if the item costs $1.40 and the customer pays $2.00, then the user will enter 140 for the price of the item and 200 for the amount paid by the customer. The program will compute and output the number of coins of each denomination quarters, dimes, nickels, and penniesthe vending machine must return to the customer. For example, if the change owed is 94 cents, the vending machine must return 3 quarters, 1 dime, 1 nickel, and 4 pennies. You may assume the amount paid by the customer is at least as large as the price of the item.
Sample Run The following sample shows how the screen must look when your program runs. You must strictly follow this format, wording, spacing, and alignment. The characters in red are typed by the user. The other characters are output by the program. Price ----- 140 Paid ------ 200 Change ------ Quarters -- 2 Dimes ----- 1 Nickels --- 0 Pennies --- 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started