Question: PROG 2 0 7 9 9 : Data Structures and Algorithm Dev in C Evaluation: 1 0 points. Change Calculator Write a C program that

PROG20799: Data Structures and Algorithm Dev in C
Evaluation: 10 points.
Change Calculator
Write a C program that calculates the change as follows:
1. Prompt the user for the amount of purchase, use variable name moneyOwed.
2. Prompt the user for the amount paid, use variable name moneyPaid.
3. Calculate the change in details. Declare an integer array change[] of size 5, where the 0th item
is the number of dollars, the 1st is the number of quarters, the 2nd is the number of dimes, the
3rd is the number of nickels, and 4th is the number of pennies. You must use a function called
calcChange, call it in main() as calcChange(moneyOwed, moneyPaid, change), to perform this
task.
4. Print out the results.
Requirements:
1. Follow the principle of modular design where all input/output statements must be in the main()
function.
2. Define the calcChange function in a separate C file named changeUtil.c along with its header
file changeUtil.h.
3. Report an error for negative numbers or zero input.
4. Report an error if money paid is not enough.
5. If error occurs, give the user another try.
6. Your program should be reasonably optimized: use proper data types, minimize the code.
7. Your program should have the following output (sample data here):
Evaluation:
Your assignment will be graded based on the following:
1. The program runs without errors (logic and syntax).
2. Functional requirements of the assignment are properly/completely met.
3. Formatting, comments, indentation and variable name conventions are adequately
followed.
Good luck! Prof: Abdullah A.

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!