QuestionQuestion

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.”

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[20], inv_wds[20], 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.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

** HOMEWORK: Inventory Tracking Program
**
** Name:
**
** Class: C Programming
**
** Date:
**
** Description: This program calculates the inventory of game cartridges. First,
** the user is asked to enter a beginning number. Next, the values entered
** to account for the amount of additions and withdrawals to be made. Third,
** both additions and withdrawals entries will be calculated from the running
** total of inventory. Finally, a report is to be printed based on the entered
** data given about the game cartridge inventory records.
********************************************************************************/

// Libraries used
#include <stdio.h>
#include <stdlib.h>

// Beginning of main method
int main(void)
{
    // Declare variables
    char c;
    int inputAmt;
    int addEntInd;
    int addOutInd;
    int withEntInd;
    int withOutInd;
    int inv_adds[20], inv_wds[20], inv_begin_amt, inv_running_amt;
    int noOfAdds;
    int noOfWithds;
   
    // Prints out the welcome message
    printf("\nWelcome to the Acme Vintage Game Store Inventory System.");
   
    // Do-while loop for entering the number of cartridges
    do
    {
       // Prompt for the number of game cartridges
       printf("\n\nEnter the current number of Game Cartridges in the inventory: ");
       // Input number of courses
       scanf("%d", &inv_begin_amt);
       // Clears input buffer
       while((c = getchar...

By purchasing this solution you'll be able to access the following files:
Solution.c and Solution.exe.

$8.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats