Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Implement the following code in C. 4. First, write your program to handle the situation where there is no shortage, and you have all the
Implement the following code in C.
4. First, write your program to handle the situation where there is no shortage, and you have all the coins and bills available. Create a function to prompt the user to enter an amount. This function should be named prompt_user_for_amount(). 5. Create another function called calculate change ( ), which takes one input parameter, the amount of money needed to give back, and then one output parameter for each of the eight denominations, giving 9 parameters in total. 6. Next, write a function to print the results, print_change ( ), with the eight denominations as parameters. 7. Validate your program works by running it and scripting with the following amounts: a) b) c) d) e) 116.23 5.99 0.32 278.92 52.00 IN GOD WE TRUST S 0 8. Copy your source code to a new file to modify, keeping the working first part separate. lab4.c lab4_with_shortages.c 9. Create a function to prompt the user to ask for shortages, after the user enters the amount. This should be a separate function, called prompt_for_shortages ( ), that takes a string to use for a prompt and returns the one that's missing, using the symbolic constants below. The prototype should look like the following: int prompt_for_shortages( char *prompt ); You will need to invoke this function three times, giving the user an opportunity to identify up to three denominations as missing. 10. We will use the following codes to represent the various denominations in the program, and these codes are what the function prompt_for_shortages ( ) will return. If there are no missing denominations, all three of these return parameters will be NO_MISSING. #define NOTHING MISSING #define NO PENNIES #define NO NICKELS #define NO DIMES #define NO QUARTERS #define NO DOLLARS #define NO FIVES #define NO TENS #define NO TWENTIES 0 1 2 3 4 5 6 7 8 11. Now you can add IF statements to the program, to check to see if any given denominations are missing 12. To make sure your program is working correctly, create a script of the output using the same values from the first part above, but this time, eliminate a) dollars and dimes b) fives, dimes, and nickels c) twenties and penniesStep 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