Production and Sales Analysis

A company manufactures five categories of products and the number of items manufactured and sold are recorded  product-wise every week in a month. The company reviews its production schedule at every month-end. The review may require one or more of the following information: 

(a)  Value of weekly production and sales.
(b)  Total value of all the products manufactured.
(c)  Total value of all the products sold.
(d)  Total value of each product, manufactured and sold.

 Let us represent the products manufactured and sold by two two-dimensional arrays M and S respectively. Then,


 M =

M11
M12
M13
M14
M15
M21
M22
M23
M24
M25
M31
M32
M33
M34
M35
M41
M42
M43
M44
M45

 S  =

S11
S12
S13
S14
S15
S21
S22
S23
S24
S25
S31
S32
S33
S34
S35
S41
S42
S43
S44
S45


where Mij represents the number of jth type product manufactured in ith week and Sij the number of jth product sold in ith week. We may also represent the cost of each product by a single dimensional array C as follows:

C  =

C1


C2

C3

C4

C5


where Cj is the cost of jth type product.
   
We shall represent the value of products manufactured and sold by two value arrays, namely, Mvalue and Svalue. Then,

    Mvalue[i][j] = Mij x Cj
    Svalue[i][j] = Sij x Cj

A program to generate the required outputs for the review meeting is shown in Fig.7.10. The following additional variables are used:

Mweek[i]    = Value of all the products manufactured in week i.

                   5
           =     S        Mvalue[i][j]
                  j=1

Sweek[i]    = Value of all the products sold in week i

                  5
         =      S       Svalue[i][j]
                  j=1

Mproduct[j] = Value of jth type product manufactured during the month

                     4
            =      S       Mvalue[i][j]
                  i=1

Sproduct[j] =  Value of jth type product sold during the month

                    4
           =     S       Svalue[i][j]
                  i=1

Mtotal     =   Total value of all the products sold during the month

                      4                           5
          =   S     Mweek[i]  =  S        Mproduct[j]
               i=1                        j=1

Stotal      =  Total value of all the products sold during the month

          4                          5
 =      S     Sweek[i] =   S       Sproduct[j]
        i=1                       j=1



PRODUCTION AND SALES ANALYSIS
Program  
   main( )                                                    
   {                                                          
       int M[5][6],S[5][6],C[6],                              
           Mvalue[5][6],Svalue[5][6],                         
           Mweek[5], Sweek[5],                                
           Mproduct[6], Sproduct[6],                          
           Mtotal, Stotal, i,j,number;                        
                                                              
   /*      Input data         */                              
                                                              
       printf (" Enter products manufactured week_wise \n");  
       printf (" M11,M12,----,  M21,M22,----  etc\n");        
     

       for(i=1; i<=4; i++)                                    
          for(j=1;j<=5; j++)                                  
             scanf("%d",&M[i][j]);                            
                                                              
       printf (" Enter products sold week_wise\n");           
       printf (" S11,S12,----,  S21,S22,----  etc\n");        
                                                               
       for(i=1; i<=4; i++)                                    
          for(j=1; j<=5; j++)                                 
             scanf("%d", &S[i][j]);                           
                                                               
       printf(" Enter cost of each product\n");               
       for(j=1; j <=5; j++)                                   
          scanf("%d",&C[j]);                                  
   /*  Value matrices of production and sales  */             
       for(i=1; i<=4; i++)                                    
          for(j=1; j<=5; j++)                                 
          {                                                   
             Mvalue[i][j] = M[i][j] * C[j];                   
             Svalue[i][j] = S[i][j] * C[j];                   
          }                                                   
   /*  Total value of weekly production and sales  */         
       for(i=1; i<=4; i++)                                    
       {                                                      
          Mweek[i] = 0 ;                                      
          Sweek[i] = 0 ;                                      
          for(j=1; j<=5; j++)                                 
          {                                                   
             Mweek[i] += Mvalue[i][j];                        
             Sweek[i] += Svalue[i][j];                        
          }                                                    
       }                                                      
   /* Monthly value of product_wise production and sales  */  
       for(j=1; j<=5; j++)                                    
       {                                                       
          Mproduct[j] = 0 ;                                   
          Sproduct[j] = 0 ;                                   
          for(i=1; i<=4; i++)                                 
          {                                                    
             Mproduct[j] += Mvalue[i][j];                     
             Sproduct[j] += Svalue[i][j];                     
          }                                                   
       }                                                       





                                                             
   /*  Grand total of production and sales values  */                                                                       

       Mtotal = Stotal = 0;                                   
       for(i=1; i<=4; i++)                                    
       {                                                      
          Mtotal += Mweek[i];                                 
          Stotal += Sweek[i];                                 
       }                                                      

       /***********************************************       
        Selection and printing of information required        
       ***********************************************/       
       printf("\n\n");                                        
       printf(" Following is the list of things you can\n");  
       printf(" request for. Enter appropriate item number\n");
       printf(" and press RETURN Key\n\n");                   
                                                              
       printf(" 1.Value matrices of production & sales\n");   
                                                              
       printf(" 2.Total value of weekly production & sales\n");
                                                              
       printf(" 3.Product_wise monthly value of production &");
       printf(" sales\n");                                    
                                                               
       printf(" 4.Grand total value of production & sales\n");
                                                              
       printf(" 5.Exit\n");                                   
                                                               
       number = 0;                                            
       while(1)                                               
       {      /* Beginning of while loop */                   
            printf("\n\n ENTER YOUR CHOICE:");                
            scanf("%d",&number);                              
            printf("\n");                                     
                                                              
            if(number == 5)                                   
            {                                                 
               printf(" G O O D   B Y E\n\n");                
               break;                                         
            }                                                  
            switch(number)                                    
            { /* Beginning of switch */                       
   







                                                          
   /*     V A L U E   M A T R I C E S    */                   
                                                              
            case 1:                                           
               printf(" VALUE MATRIX OF PRODUCTION\n\n");     
               for(i=1; i<=4; i++)                            
               {                                              
                  printf(" Week(%d)\t",i);                    
                  for(j=1; j <=5; j++)                        
                     printf("%7d", Mvalue[i][j]);             
                  printf("\n");                               
               }                                              
               printf("\n VALUE MATRIX OF SALES\n\n");        
               for(i=1; i <=4; i++)                           
               {                                              
                  printf(" Week(%d)\t",i);                    
                  for(j=1; j <=5; j++)                        
                    printf("%7d", Svalue[i][j]);              
                  printf("\n");                               
               }                                              
               break;  
                                      
                                                               
   /*    W E E K L Y   A N A L Y S I S    */                  
                                                              
            case 2:                                           
               printf(" TOTAL WEEKLY PRODUCTION & SALES\n\n");
               printf("              PRODUCTION   SALES\n");  
               printf("              ----------   -----\n");  
               for(i=1; i <=4; i++)                           
               {                                              
                  printf(" Week(%d)\t", i);                   
                  printf("%7d\t%7d\n", Mweek[i], Sweek[i]);   
               }                                              
               break;                                         
                                                              
   /*    P R O D U C T W I S E    A N A L Y S I S  */         
                                                              
            case 3:                                           
               printf(" PRODUCT_WISE TOTAL PRODUCTION &");    
               printf(" SALES\n\n");                          
               printf("               PRODUCTION   SALES\n"); 
               printf("               ----------   -----\n"); 
               for(j=1; j <=5; j++)                           
               {                                              
                  printf(" Product(%d)\t", j);                
                  printf("%7d\t%7d\n",Mproduct[j],Sproduct[j]);
               }                                              
               break;                                         
      


   /*    G R A N D   T O T A L S    */                         
                                                              
            case 4:                                           
               printf(" GRAND TOTAL OF PRODUCTION & SALES\n");
               printf("\n Total production = %d\n", Mtotal);   
               printf(" Total sales      = %d\n", Stotal);    
               break;                                         
                                                              
   /*    D E F A U L T   */                                    
                                                              
            default :                                         
               printf(" Wrong choice, select again\n\n");     
               break;                                          
                                                              
                                                              
            } /* End of switch */                             
                                                               
       } /* End of while loop */                              
                                                              
       printf(" Exit from the program\n\n");                  
                                                               
   } /* End of main */                                        
                                          

                                                           
 Output                                                     
                                                               
   Enter products manufactured week_wise                      
   M11,M12,----,  M21,M22,----  etc                           
   11  15  12  14  13                                         
   13  13  14  15  12                                         
   12  16  10  15  14                                         
   14  11  15  13  12                                         
                                                       
   Enter products sold week_wise                                     
   S11,S12,----,  S21,S22,----  etc                          
   10  13   9  12  11                                         
   12  10  12  14  10                                         
   11  14  10  14  12                                          
   12  10  13  11  10                                         
   Enter cost of each product                                 
   10  20  30  15  25                                         
                                                              
  Following is the list of things you can                    
  request for. Enter appropriate item number                 
  and press RETURN key                                       
                                                              
  1.Value matrices of production & sales                     
  2.Total value of weekly production & sales                 
  3.Product_wise monthly value of production & sales         
  4.Grand total value of production & sales                  
  5.Exit                                                     
  ENTER YOUR CHOICE:1                                        
  VALUE MATRIX OF PRODUCTION                                 
   Week(1)           110     300     360     210     325     
   Week(2)           130     260     420     225     300     
   Week(3)           120     320     300     225     350      
   Week(4)           140     220     450     185     300      
  VALUE MATRIX OF SALES            
  Week(1)           100     260     270     180     275      
  Week(2)           120     200     360     210     250           
  Week(3)           110     280     300     210     300      
  Week(4)           120     200     390     165     250       
                                        
                                                              
   ENTER YOUR CHOICE:2                                        
   TOTAL WEEKLY PRODUCTION & SALES                            
                PRODUCTION   SALES                            
                ----------   -----                            
   Week(1)         1305      1085                             
   Week(2)         1335      1140                             
   Week(3)         1315      1200                             
   Week(4)         1305      1125                             
                                                              
                                                           
   ENTER YOUR CHOICE:3                                         
   PRODUCT_WISE TOTAL PRODUCTION & SALES                      
                                                              
                 PRODUCTION   SALES                           
                 ----------   -----                           
   Product(1)       500        450                             
   Product(2)      1100        940                             
   Product(3)      1530       1320                             
   Product(4)       855        765                             
   Product(5)      1275       1075                             
                                                              
   ENTER YOUR CHOICE:4                                        
   GRAND TOTAL OF PRODUCTION & SALES                          
                                                              
   Total production = 5260                                    
   Total sales      = 4550                                    

   ENTER YOUR CHOICE:5                                        
   G O O D   B Y E                                            

  Exit from the program    

No comments:

Post a Comment

Copyright © EduRAR @ www.edurar.blogspot.in