C code of stage 2 of Cocomo 2 Model

Rabu, 02 April 2014

//C program to calculate adjust effort and person month in stage-2 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[7][6]={"RCPX","RUSE","PDIF","PERS","PREX","FCIL","SCED"};
  float driver[7][7]={
            {0.73,.81,.98,1,1.30,1.74,2.38},
            {-1,-1,.95,1,1.07,1.15,1.24},
            {-1,-1,.87,1,1.29,1.81,2.61},
            {2.12,1.62,1.26,1,.83,.63,.50},
            {1.59,1.33,1.12,1,.87,.71,.62},
            {1.43,1.30,1.10,1,1,.73,.62},
            {-1,1.43,1.14,1,-1,1,-1}
             };
  clrscr();
  printf("
Enter the size of project (in KLOC) : ");
  scanf("%d",&size);
  for(i=0;i<5;i++)
  {
     printf("
Rate Scaling Factor %s on the scale of 0-5 :
",scale_factors[i]);
     printf("

0 - Very Low 1 - Low 2 - Nominal 3 - High 4 - Very High 5 - Extra High

");
     scanf("%d",&rating);
     F=F+scale_table[i][rating];
   }
   B=0.91+(0.01*F);
   printf("
B (scale factor) = %f",B);
   PM_nominal=2.5*pow(size,B);
   printf("
Nominal Effort = %f Person-Month",PM_nominal);
   EM=1;
   for(i=0;i<7;i++)
   {
     do
     {
      printf("
Rate Cost Driver %s on scale of (0-6) : ",cost_drivers[i]);
      printf("

0 - Extra Low 1 - Very Low 2 - Low 3 - Nominal 4 - High 5 - Very High 6 -   Extra High

");
      scanf("%d",&rating);
      a=driver[i][rating];
      if(a==-1)
    printf("
No value exists for this Rating..Enter another rating..
");
     }while(a==-1);
      EM=EM*a;
   }
   PM_adjusted=PM_nominal * EM;
   printf("
Adjusted Effort (PM_adjusted) = %f Person-Month",PM_adjusted);
getch();
}

Related Posts by Categories

0 komentar:

Posting Komentar