Lab 6 - Using Output Parameters
Due - March 29/30, 2004
In this lab, you will write a program that uses pointers and functions with output parameters. Your program will ask the user for the cost of an item and the amount of payment. Your program will then calculate the number of 20 dollar bills, 10 dollar bills, 5 dollar bills, 1 dollar bills, quarters, dimes, nickels, and pennies owed as change to the user. A sample run of your program might look like the following:
Enter price:
25.45
Enter payment:
30.00
Your change is 4.55. You should receive:
1 - nickel
2 - quarters
4 - 1 dollar bills
Your program should have three functions. Function 1 should get the price of the item and the amount of payment. Function 2 should calculate the number of 20s, 10s, 5s, 1s, quarters, dimes, nickels, and pennies. Function 3 should print the results.
As you design your program, think carefully about which arguments will need to be passed as pointers, and which will not. An argument should only be passed as a pointer if the function will change the value.
- Make sure that each function is well documented. Your documentation should specify the type and role of all arguments.
- Make sure a lab assistant (Dianne or I) has seen your program run.
- Copy and paste the output of your program to the bottom of your program itself. Make sure the output is a comment. That means, put a /* before the output and a */ after the output.
Sami Rollins