Question: Your program must meet the following specifications 1. At program start, assume a stock of 10 nickels, 10 dimes, 10 quarters, and 10 pennies 2.

 Your program must meet the following specifications 1. At program start,

assume a stock of 10 nickels, 10 dimes, 10 quarters, and 10

pennies 2. Repeatedly prompt the user for a price in the form

Your program must meet the following specifications 1. At program start, assume a stock of 10 nickels, 10 dimes, 10 quarters, and 10 pennies 2. Repeatedly prompt the user for a price in the form xx. xx, where x denotes a digit, or to enter 'q to quit When a price is entered: a. 3. If the price entered is negative, print an error message and start over requesting either a new price or to quit (indicated by entering a 'q') b. Prompt for the number of dollars in payment. If the payment is insufficient, print an error message and reprompt for payment Next determine the coins to be dispensed as change. This calculation will depend on the amount to be dispensed and also on the number of coins left in the stock. For example, the least number of coins needed to make change of S1.30 is 6: 5 quarters and 1 nickel. But if there are only 3 quarters, 3 dimes, and 10 nickels left in the stock, then the least number is 11: 3 quarters, 3 dimes, and 5 nickels c. d. Print the numbers of the coins to be dispensed as change and their denominations. (Omit a denomination if no coins of that denomination will be dispensed.) e. In case exact payment is made, print a message such as "No change." I. If the change cannot be made up with the coins remainng, print an error message and halt the program Just before quitting, print the total amount (the number of dollars and number of cents) left in the stock. 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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

Students Have Also Explored These Related Databases Questions!