Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PROG 2 0 7 9 9 : Data Structures and Algorithm Dev in C Evaluation: 1 0 points. Change Calculator Write a C program that
PROG: Data Structures and Algorithm Dev in C
Evaluation: points.
Change Calculator
Write a C program that calculates the change as follows:
Prompt the user for the amount of purchase, use variable name moneyOwed.
Prompt the user for the amount paid, use variable name moneyPaid.
Calculate the change in details. Declare an integer array change of size where the th item
is the number of dollars, the st is the number of quarters, the nd is the number of dimes, the
rd is the number of nickels, and th is the number of pennies. You must use a function called
calcChange, call it in main as calcChangemoneyOwed moneyPaid, change to perform this
task.
Print out the results.
Requirements:
Follow the principle of modular design where all inputoutput statements must be in the main
function.
Define the calcChange function in a separate C file named changeUtil.c along with its header
file changeUtil.h
Report an error for negative numbers or zero input.
Report an error if money paid is not enough.
If error occurs, give the user another try.
Your program should be reasonably optimized: use proper data types, minimize the code.
Your program should have the following output sample data here:
Evaluation:
Your assignment will be graded based on the following:
The program runs without errors logic and syntax
Functional requirements of the assignment are properlycompletely met.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started