As the CIO of your company you are interested in the sales p

As the CIO of your company, you are interested in the sales performance of a new product being carried in your 12 stores. You have decided to write a program that will allow you to enter in the original quantity of the item shipped to each of the stores and the current number still remaining. From this data, you can calculate some statistics to determine whether to continue offering the item.

Keep the following points in mind when creating your program:

Come up with your own company and product name.

Store #5 is currently being remodeled. Your program should skip this store and not include it in the computations.

Error checking should be done for negative entries and remaining quantities greater than the original number available in the store.

After gathering your data, display the following results in your program:

Total quantity of items in all 12 stores

Total number of items sold

Total number of items remaining

Number of stores with zero items left in the store

Number of stores with less than half of their original quantity remaining

Overall average number of items sold

Overall percentage of items sold

Implement all three looping constructs in your program.

Implement shortcut operators where appropriate.

Output should be labeled, aligned, and formatted to 2 decimal places for the average and percentage.

Display a creative message indicating that the product should be continued if the overall percentage is over 50% or to discontinue if it is not.

Make sure you are using the correct data types and descriptive variable names.

Add a comment to the top of your program that includes your name, the program name, and a description of the program code.

Include descriptive comments throughout your program.

Test your data!

Solution

/*
Program:Company Statistics
Description:I have one company i.e Nestle ehich has 12 stores with product called
Maggie.I have used all 3 loops here.As shop 5 is under construction it is discarded
from computation.It calculates following:
Total quantity of items in all 12 stores
Total number of items sold
Total number of items remaining
Number of stores with zero items left in the store
Number of stores with less than half of their original quantity remaining
Overall average number of items sold
Overall percentage of items sold
A creative message indicating that the product should be continued if the overall percentage
is over 50% or to discontinue if it is not.


*/

#include<bits/stdc++.h>
using namespace std;


class Nestle //Comapny Nestle
{
   public:
   string ProductName;
   int OriginalQ,RemainingQ; //Original and Remaining Quantity

   Nestle()
   {
       this->ProductName=\"Maggie\";
       this->OriginalQ=0;
       this->RemainingQ=0;
   }
   Nestle(string ProductName,int OriginalQ,int RemainingQ)
   {
       this->ProductName=ProductName;
       this->OriginalQ=OriginalQ;
       this->RemainingQ=RemainingQ;
   }
  
};

int main(int argc, char const *argv[])
{
   /* code */

   Nestle stores[12]; //12 shops as Object
   int OriginalQ,RemainingQ;
   for(int i=0;i<12;i++) //accept data from user
   {
       LOOP:
       stores[i].ProductName=\"Maggie\";
       cout<<\"Enter Details for Shop No:\"<<i+1<<\"\ \";
       cout<<\"Enter Original Quantity of product\ \";

      
      
       cin>>OriginalQ;
       if(OriginalQ<0)       //Error Checking
       {
           cout<<\"Negative Value\ \";
           cout<<\"Enter correct value\ \";
           goto LOOP;
       }

       cout<<\"Enter Remaining Quantity of product\ \";
       cin>>RemainingQ;

       if(RemainingQ<0)
       {
           cout<<\"Negative Value\ \";
           cout<<\"Enter correct value\ \";
           goto LOOP;
       }
       if(OriginalQ<RemainingQ)
       {
           cout<<\"Original Quantity cannot be less than Remaining Quantity\ \";
           goto LOOP;
       }

       stores[i].OriginalQ=OriginalQ;
       stores[i].RemainingQ=RemainingQ;


   }

   cout<<\"======================Output=========================\ \";

       cout<<\"Total quantity of items in all 12 stores(Exclude shop 5)\ \";

       float TotalQ=0; //Total quantity of items
       for(int i=0;i<12;i++)
       {
           if(i!=4) //Exclude shop 5
               TotalQ+=stores[i].OriginalQ;
       }
       cout<<TotalQ<<\"\ \";


       cout<<\"Total number of items sold in all 12 stores(Exclude shop 5)\ \";

       float TotalSold=0;//Total number of items sold
       for(int i=0;i<12;i++)
       {
           int TotalSold1=0;
           if(i!=4)
           {
               TotalSold1=stores[i].OriginalQ-stores[i].RemainingQ;
               TotalSold+=TotalSold1;
           }
          
       }
       cout<<TotalSold<<\"\ \";

       cout<<\"Total number of items remaining in all 12 stores(Exclude shop 5)\ \";

       int TotalRem=0;//Total number of items remaining
       for(int i=0;i<12;i++)
       {
          
           if(i!=4)
           {
              
               TotalRem+=stores[i].RemainingQ;
           }
          
       }
       cout<<TotalRem<<\"\ \";

      


       cout<<\"Total number of stores with zero items left in the store in all 12 stores(Exclude shop 5)\ \";

       int TotalStoreZero=0; //Total number of stores with zero items left
       for(int i=0;i<12;i++)
       {
          
           if(i!=4)
           {
               if(stores[i].RemainingQ==0)
                   TotalStoreZero++;
           }
          
       }
       cout<<TotalStoreZero<<\"\ \";


   cout<<\"Total number of stores with with less than half of their original quantity remaining(Exclude shop 5)\ \";  


       int TotalStoreHalf=0;//Total number of stores with with less than half of their original
       int i=0;
       do
       {
          
           if(i!=4)
           {
               if(stores[i].RemainingQ<=(stores[i].OriginalQ)/2)
                   TotalStoreHalf++;
           }
           i++;
       }while(i<=11);
       cout<<TotalStoreHalf<<\"\ \";

       cout<<\"Avearge number of items in all 12 stores(Exclude shop 5)\ \";

       int sum=0;float avg=0;
       i=0;
       while(i<12)
       {
          
           if(i!=4)
           {
               int ItemsSold=stores[i].OriginalQ-stores[i].RemainingQ;
               sum=sum+ItemsSold;
           }
           i++;
          
       }

       avg=(float)sum/11;
       cout<<avg<<\"\ \";
      

      


       cout<<\"Percentage of Items sold\ (Exclude shop 5)\ \";
      
       //Percentage of Items sold
       float t=(float)TotalSold/TotalQ;
       float Percentage=t*100;
       cout<<Percentage<<\"\ \";

       float Fifty=50.00f;
       if(Percentage>=Fifty)
           cout<<\"Continue sell of product\ \";
       else
           cout<<\"Discontinue sell of product\ \";


   return 0;
}

As the CIO of your company, you are interested in the sales performance of a new product being carried in your 12 stores. You have decided to write a program th
As the CIO of your company, you are interested in the sales performance of a new product being carried in your 12 stores. You have decided to write a program th
As the CIO of your company, you are interested in the sales performance of a new product being carried in your 12 stores. You have decided to write a program th
As the CIO of your company, you are interested in the sales performance of a new product being carried in your 12 stores. You have decided to write a program th
As the CIO of your company, you are interested in the sales performance of a new product being carried in your 12 stores. You have decided to write a program th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site