Question: ents ng In this assignment you will practice practical control structures. If you can store variables (by declaring ints and doubles), perform computations (using operators

 ents ng In this assignment you will practice practical control structures.
If you can store variables (by declaring ints and doubles), perform computations
(using operators but no built-in math functions), control the order in which
statements are executed (using if to bypass and while to reverse), and
perform console 1/0 (with cin and cout), then you basically have all

ents ng In this assignment you will practice practical control structures. If you can store variables (by declaring ints and doubles), perform computations (using operators but no built-in math functions), control the order in which statements are executed (using if to bypass and while to reverse), and perform console 1/0 (with cin and cout), then you basically have all the logical and calculational tools you need to solve almost any problem. While the additional use of functions, arrays, structs, data structures, recursion, and object-oriented programming makes it easier to write some solutions, they do not really provide any more basic capabilities, so do NOT use them in this assignment. A main point of this assignmeye is to see if you understand and can deal with "round-off error" as discussed in the module reading. There's more than one way to do this, so make sure you accommodate it correctly. Background This involves a problem from an annual IBM-sponsored ACM (Association for Computing Machinery) Pacific North West Regional Programming Contest, a competition among 2- and 4-year colleges from Alaska to Nevada to Hawaii. The solution is not as easy as it might seem. It involves the completion of several complicated steps, and then assembling those steps into a solution. As a programmer, you need to develop the skill to attack a large problem by breaking it down into smaller ones that you can solve. In order to guide you through such a process, this lab assignment is presented in multiple steps. There are 5 separate steps. Follow them carefully, to practice how to develop C++ programs. In the first step you will create a new C++ program file. In the remaining steps, you will add to the file so that it develops into a complete solution nt Modern grocery stores now often have a "U-Scan" checkout lane, allowing the customer to scan and check out their own groceries, without the need of a human checker. These lanes require that change be provided automatically, after the customer sticks their cash in a slot. You are to write a program that computes the bills and coins to be dispensed, minimizing the total number of bills and colns. (That is, for change totaling $5.50, you should not dispense 5 ones and 50 pennies, but a $5 bill and a 50-cent piece instead.) The bills and coins available for you to dispense are as follows: $100 bill, $50 bill, $20 bill, $10 bill, $5 bill, $1 bill, 50- cent coin, 25-cent coln, 10-cent coln, 5-cent coin, 1-cent coin. The console-based program prompts the user to input 2 numbers. The first number is the amount of the purchase, and the second one is the amount tendered by the customer. You may assume that the amount tendered is greater than or equal to the amount of purchase. The console output will be a series of lines showing the amount of change returned and detailing the nuntber of bills and coins that will be dispensed as change, in descending order of monetary amount, one unit per line. If a bill/coin is not needed in the change returned, no output is produced for that bill/coin. (In other words, do not display "o $1 bills".) Plural logic. Proper use of plurals is required, as shown in the sample below. This will require some if-else logic to decide whether or not to append an "s" to the end of a denomination name. Here the sample -- for a purchase of 42.15, the amount tendered is 50. There are no $'s or commas in the input -- just positive real numbers that may or may not contain a decimal. Here is the output: $7.85 1 $5 bill 2 $1 bills 1 50-cent coin 1 25-cent coin 1 10-cent coin $7.85 1 $5 bill 2 $1 bills 1 50-cent coin 1 25-cent coin 1 10-cent coin The program ends normally after the output is produced. Here are some more samples, for a purchase of $13.30 and a tender of $15, and for a 1-cent purchase with a $500 bill: $1.70 1 $1 bill 1 50-cent coin 2 18-cent coins 5499.99 4 $100 bills 1 550 bill 2 $20 bills 1 35 bili 4 $1 bills 1 50-cent coin 1 25-cent coin 2 10-cent coins 4 1-cent coins Steps In Software Development STEP 1 of 5: Getting Started Write your first version of the program with only an empty int main function. Name the.cpp file as you wish. Verify that you can compile and run the program (which should do nothing!). Add your identifying comments and couts (with their required library includes), save, compile, and run again. STEP 2 of 5: Collecting Input Add statements to prompt the user for the two numbers -- purchase amount and amount tendered. Allow the user to enter both amounts on the same input line, space-separated -- that is, use cin> and do not Steps STEP 1 of 5: Getting Started Write your first version of the program with only an empty int main function. Name the.cpp file as you wish. Verify that you can compile and run the program (which should do nothing!). Add your identifying comments and couts (with their required library includes), save, compile, and run again. STEP 2 of 5: Collecting Input Add statements to prompt the user for the two numbers -- purchase amount and amount tendered. Allow the user to enter both amounts on the same input line, space-separated -- that is, use ciros, and do not use getlina orcin.ignore. Verify that you can compile and run the program. STEP 3 of 5: Producing Output Calculate the amount of change returned, and output it with the proper formatting. Show the amount with two decimal places, representing cents, and be sure to account for floating point round-off errors. For example, if the purchase is 1.02, and the amount tendered is 1.10, then the change should be 0.08 -- not 0.079999999 and not 0.080000001, and certainly not 0.07. STEP 4 of 5: Solving The Problem Write the C++ code blocks needed to determine the numbers of bills and coins to dispense in order to make the correct change. There is no trick logic in the US monetary system -- start with the highest denomination. Count out as many of that denomination as needed, one-by-one, until the remaining amount falls below the value of the denomination. Then go to the next lower denomination, etc. Do not use functions in this assignment Do not worry about formatting of the output at this point -- focus on getting exact results. STEP 5 of 5: Final Formatting Complete the formatting of the results as per the problem statement. Compile and run. Submit the completed CPP. Write the C++ code blocks needed to determine the numbers of bills and coins to dispense in order to make the correct change. There is no trick logic in the US monetary system -- start with the highest denomination. Count out as many of that denomination as needed, one-by-one, until the remaining amount falls below the value of the denomination. Then go to the next lower denomination, etc. Do not use functions in this assignment. Do not worry about formatting of the output at this point -- focus on getting exact results. STEP 5 of 5: Final Formatting Complete the formatting of the results as per the problem statement. Compile and run. Submit the completed CPP. Hints This problem is not as easy as it seems. Be aware of the effects of round-off error, and remember not to test floating point values for exact equality. Remember that with floating point values and computers, 4 minus 2 can often result in 1.9999999999999999 instead of 2, and that is not greater or equal to 2! So instead of asking in an amount is greater than or equal to (for example) $50, ask if it's greater than $49.999 -- no need to check or equal to". That allows for a round-off error of as much as 0.1 cents, which is way larger than one would ever expect, but not so large that it would overlap the next cent amount, $49.99. Cashiers solve this problem every day, without using division and dealing with remainders. So your program should be able to solve it too, without divide or modulus and without cmath. Think about it -- it's not hard. "Never assume anything!". Test your program with various input values. Try to break your own program before you give someone else the opportunity to do so. Submit your.cpp file for grading and don't forget your identification code blocks

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!