PROGRAMMING ASSIGNMENT #4
Write a C program that allows the user to make some inventory transactions. The program should first prompt the user to enter how many items in the current inventory.
The program should then prompt the user to enter the number of inventory number of additions to make and the number of inventory withdrawals to make. For this assignment, let’s set a maximum of 20 additions and 20 withdrawals.
Using a loop, the program should then prompt the user to enter the amount of the first addition (a positive amount to add to the inventory balance), the amount of the second, the third, etc., until the number of the additions have been processed.
Using a second loop, the program should then prompt the user to enter the amount of the first withdrawal (a positive amount to subtract from the inventory balance, if possible), the amount of the second withdrawal, the third, etc. until the number of withdrawals have been processed. Once all additions and withdrawals have been made, the program should output the ending quantity of the item. I used widgets but you should change yours to a unique item.
The dialog with the user should look similar to the following, only with your special introductory statement(s) as you wish:
Welcome to the Acme Inventory System (or whatever you wish here)
Enter the current number of Widgets in the inventory: 12
Enter the number of additions(1-20): 3
Enter the number of withdrawals(1-20): 2
Enter the addition #1: 10
Enter the addition #2: 11
Enter the addition #3: -3
Error, your entry must be greater than 0, try again.
Enter the addition #3: 3
Enter the withdrawal #1: 25
Enter the withdrawal #2: 35
Error, your entry must be between 1 and 11, try again.
Enter the withdrawal #2: 3
The ending number of Widgets is 8.
Time to order Widgets!
*** Inventory Recap ***
Starting Number of Widgets: 12
Addition #1: 10
Addition #2: 11
Addition #3: 3
Withdrawal #1: 35
Withdrawal #2: 3
Ending Number of Widgets: 8
Read all the specifications carefully. I did not show all of the editing features you are required to do.
The line just before the recap is based on the following:
If the closing number is greater than or equal to 10, output:
“Time to order (name).”
If the closing number is between 11 and 100, output:
“(name) inventory is at an adequate level”
If the closing number is over 101, output:
“You are overstocked with (name). Do not order any more.”
Save your time - order a paper!
Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlinesOrder Paper Now
Regarding error checking on all user input, the following check should be made while users are entering the withdrawals: If the withdrawal exceeds the number of items on hand, including the additions, the program should issue the following error message as shown above in the sample run.
Also, if the current number goes to zero, no more withdrawals should be made and an appropriate message should appear (that one’s up to you! Use some polite creativity!)
You are to keep track of all the additions and all the withdrawals so that you can print them out in “recap report” form. You do this by storing them in arrays. You will have one array to hold the additions entered by the user, and another array to hold the withdrawals.
A suggestion for variables besides the loop index variables and char c is:
int inv_adds, inv_wds, inv_begin_amt, inv_running_amt;
It is hard to see this, but I want you to align the values in the recap report.
NOTE: You must validate (trap-loop) the number if additions, withdrawals, and the values of these to be within the necessary boundaries