C code of stage 1 of Cocomo 2 Model

Minggu, 30 Maret 2014

//C program to calculate effort and productivity in stage-1 of cocomo-2 model//

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

void main()
{
  int no_of_screens,no_of_reports;
  int screen[4],report[4];
  int CPLX_table[3][3]={
                {0,0,1},     //0-Small
                {0,1,2},     //1-Medium
                {1,2,2}      //2-Difficult
              };
  int weight_table[3][3]={
                {1,2,3},
                {2,5,8},
                {-1,-1,10}
              };
  int col,r_row,s_row,s_CPLX,r_CPLX;
  int rating,OP,reuse;
  float NOP,effort;
  int PROD[5]={4,7,13,25,50};

  clrscr();

  printf("
Enter number of Screens : ");
  scanf("%d",&screen[0]);

  printf("
Enter number of Screen Views : ");
  scanf("%d",&screen[1]);

  printf("
Enter number of clients and servers : ");
  scanf("%d %d",&screen[2],&screen[3]);

  printf("
Enter number of Reports : ");
  scanf("%d",&report[0]);

  printf("
Enter number of Report Sections : ");
  scanf("%d",&report[1]);

  printf("
Enter number of clients and servers : ");
  scanf("%d %d",&report[2],&report[3]);


  if(screen[1]<3)
    s_row=0;
  else if(screen[1]>=3 && screen[1]<=7)
    s_row=1;
  else if(screen[1]>=8)
    s_row=2;

  if(report[1]==0 || report[1]==1)
    r_row=0;
  else if(report[1]==2 || report[1]==3)
    r_row=1;
  else if(report[1]>=4)
    r_row=2;

    if(screen[2]<2 && screen[3]<3)
      col=0;
    else if((screen[2]>=2 && screen[2]<=3) && (screen[3]>=3 && screen[3]<=5))
      col=1;
    else if(screen[2]>3 && screen[3]>5)
      col=2;

  s_CPLX=CPLX_table[s_row][col];
  r_CPLX=CPLX_table[r_row][col];

  OP=(screen[0]*weight_table[0][s_CPLX])+(report[0]*weight_table[1][r_CPLX]);
  printf("
Object Point = %d",OP);
  printf("
Enter Reuse % : ");
  scanf("%d",&reuse);
  NOP=(OP*(100-reuse))/100.0;
  printf("
New Object Point (NOP) = %f",NOP);
  printf("
Rate Programmers Capability and Experience on Scale of 0-4 :
");
  printf("
0 - Very Low
1 - Low
2 - Nominal
3 - High
4 - Very High

");
  scanf("%d",&rating);
  printf("
Productivity = %d",PROD[rating]);
  effort=NOP/PROD[rating];
  printf("

Effort = NOP/Productivity");
  printf("
Effort = %f",effort);
getch();
}

Related Posts by Categories

0 komentar:

Posting Komentar