Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that simulates inventory bins in a warehouse. Each bin holds a n

ID: 3770152 • Letter: W

Question

Write a program that simulates inventory bins in a warehouse. Each bin holds a number of the same type of parts. The program should use a structure that keeps the following data: • Description of the part kept in the bin • Number of parts in the bin The program should have an array of ten bins initialized with the following data:

The program should have the following functions:

• addParts – a function that increases a specific bin's count by a specified number

• removeParts – a function that decreases a specific bin's count by a specified number

When the program runs it should repeat a loop that performs the following steps:

• The user should see a list of what each bin holds and how many parts are in each bin

• The user can either chose to quit the program or select a bin

• When a bin is selected, the user can either add or remove parts from it

• The loop repeats, showing the updated bin data on the screen

Input validation: no bin can hold more than 30 parts, so don't let the user add more than a bin can hold. Also don't accept negative values for the number of parts being added or removed.

Optional: you may use C++ objects instead of structs to represent an inventory bin.

USING C++

Part description Number of parts in the Bin Valve 10 Bearing 5 Bushing 15 Coupling 21 Flange 7 Gear 5 Gear Housing 5 Vaccum Gripper 25 Cable 18 Rod 12

Explanation / Answer

#include <iostream>
#include <iomanip>

using namespace std;


   void showBin (int [], int);


int main()
{

   const int SIZE = 10;
   int array1[SIZE] = {10,5,15,21,7,5,5,25,18,12};
  
   int menu, addremove, add, remove, bin_num;

   do{

  
   cout<<"*MENU* ";
   cout<<"*1. Select a Bin ";
   cout<<"*2. View Bins ";
   cout<<"*3. Quit ";
  
   cin>>menu;
   switch (menu)
   {
   case 1:
       {
                   cout<<"**************************************** ";
                   cout<<"* ENTER THE BIN NUMBER YOU WISH TO USE * ";
                   cout<<"*   1. Valve       2. Bearing       * ";
                   cout<<"*   3. Bushing       4. Coupling       * ";
                   cout<<"*   5. Flange       6. Gear           * ";
                   cout<<"*   7. Gear Housing 8. Vaccum Gripper * ";
                   cout<<"*   9. Cable       10. Rod           * ";
                   cout<<"**************************************** ";
                   cin>>bin_num;


           cout<<"*1. Add to bin       * ";
           cout<<"*2. Remove from bin      * ";
          
           cin>>addremove;
           switch(addremove)
           {
           case 1:
               {

                   cout<<"Enter how many parts you wish to add to bin"<< bin_num<<". ";
                   cin>>add;

                   int addedbin = array1[bin_num] + add;
                                    cout<<"bin "<<bin_num<<" now has "<<addedbin<<endl
               }
           case 2:
               {
                   cout<<"Enter how many parts you wish to remove from bin"<< bin_num<<". ";
                   cin>>remove;

                   int rembin = array1[bin_num] - remove;
                   cout<<"bin "<<bin_num<<" now has "<<rembin<<endl;
                   break;
               }
           break;
           }
       break;
       }
                  


   case 2:
       {

           showBin (array1, SIZE);

           break;
       }
   case 3:
       {      
       break;
       }
      
   break;
   }

   }
   while (menu != 3);

return 0;
}

void showBin (int nums[], int SIZE)
{
       for (int count = 0; count < SIZE; count++)
       cout<<nums[count]<<" ";
       cout<<endl;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote