Search Tutorials

Loading...

Thursday, 16 May 2013

C code of stage-3 of Cocomo-2 Model

//C program to calculate adjust effort and person month in stage-3 of cocomo-2 model//

#include<stdio.h>
#include<conio.h>
#include<math.h>

void main()
{
  int size,i,rating;
  float PM_nominal,PM_adjusted;
  float B,F,EM,a;
  char scale_factors[][30]={"Precedentness","Development Flexibility","Risk Resolution","Team Cohesion","Process Maturity"};
  float scale_table[5][6]={
                {6.20,4.96,3.74,2.48,1.24},
                {5.07,4.05,3.04,2.03,1.01},
                {7.07,5.65,4.24,2.83,1.41},
                {5.48,4.38,3.29,2.19,1.10},
                {7.80,6.24,4.68,3.12,1.56}
               };
  char cost_drivers[17][10]={"RELY","DATA","CPLX","RUSE","DOCU","TIME","STOR",
                              "PVOL","ACAP","PCAP","PCON","AEXP",
                               "PEXP","LTEX","TOOL","SITE","SCED"    };
  float driver[17][6]={
            {.75,.88,1.0,1.15,1.39,-1 },
            {-1,.93,1.0,1.09,1.19,-1},
            {.75,.88,1.0,1.15,1.3,1.66},
            {-1,.91,1.0,1.14,1.29,1.49},
            {.89,.95,1.0,1.06,1.13,-1},
            {-1,-1,1.0,1.11,1.31,1.67},
            {-1,-1,1.0,1.06,1.21,1.57},
            {-1,.87,1.0,1.15,1.3,-1},
            {1.5,1.22,1.0,.83,.67,-1},
            {1.37,1.16,1.0,.87,.74,-1},
            {1.24,1.10,1.0,.92,.84,-1},
            {1.22,1.10,1.0,.89,.81,-1},
            {1.25,1.12,1.0,.88,.81,-1},
            {1.22,1.10,1.00,.91,.84,-1},
            {1.24,1.12,1.0,.86,.72,-1},
            {1.25,1.10,1.0,.92,.84,.78},
            {1.29,1.10,1.0,1.0,1.0,-1}
             };
  clrscr();
  printf("\nEnter the size of project (in KLOC) : ");
  scanf("%d",&size);
  for(i=0;i<5;i++)
  {
     printf("\nRate Scaling Factor %s on the scale of 0-5 : \n",scale_factors[i]);
     printf("\n\n0 - Very Low\t1 - Low\t2 - Nominal\t3 - High\t4 - Very High\t5 - Extra High\n\n");
     scanf("%d",&rating);
     F=F+scale_table[i][rating];
   }
   B=0.91+(0.01*F);
   printf("\nB (scale factor) = %f",B);
   PM_nominal=2.5*pow(size,B);
   printf("\nNominal Effort = %f Person-Month",PM_nominal);
   EM=1;
   for(i=0;i<17;i++)
   {
     do
     {
      printf("\nRate Cost Driver '%s' on scale of (0-5) : ",cost_drivers[i]);
      printf("\n\n0 - Very Low\t1 - Low\t2 - Nominal\t3 - High\t4 - Very High\t5 -   Extra High\n\n");
      scanf("%d",&rating);
      a=driver[i][rating];
      if(a==-1)
    printf("\nNo value exists for this Rating..Enter another rating..\n");

     }while(a==-1);
      EM=EM*a;
   }
   PM_adjusted=PM_nominal * EM;
   printf("\nAdjusted Effort (PM_adjusted) = %f Person-Month",PM_adjusted);
getch();
}

No comments:

Post a Comment

Back to Top