OBJECTIVES:
- Use decision statements
- Use formulas to manipulate money amounts
OVERVIEW OF PROJECT:
Create a program to figure change. The program will accept the amount the customer owes. The second value will be the amount of money offered in payment.
The program will calculate the amount of change required and tell the cashier exactly how to return the change. The program will report the number of bills and coins that are required. The program will not suggest giving zero of any coin or bill.
PROJECT INSTRUCTIONS:
1. Create and label text boxes on a form to accept the Total Cost and the amount of Money given by the customer.
2. Create a list box to hold the change information.
3. Create a command button to tell the computer to calculate the change.
4. In a function, calculate the amount of change to return and how many of each bill and coin are required to give the customer their change. Make sure that this function clears previously displayed information to avoid confusion.
Hint:
- Use double.Parse to convert the data from the textboxes
- Convert the return amt value from dollars to cents (x 100)
- Convert the return amt in cents from double to integer by casting (this will remove the decimal portion from this number)
- Eg for thousands bill, calculate the number of piece of thousand(s) by dividing return amount (in cents) by 100000 (in cents). Then calculate the new return amount by subtracting the thousands bill.
- Continue for hundreds and so on.
Credits: Microsoft C# Projects for the Classroom (by Alfred C Thompson II)
0 comments:
Post a Comment