C code to Calculate Unadjusted Function Point UFP and Adjusted Function Point FP

#include<stdio.h>
#include<conio.h>
int fround(float x)
{
  int a;
  x=x+0.5;
  a=x;
  return(a);
}

void main()
{
  int weights[5][3]={3,4,6,4,5,6,3,4,6,7,10,15,5,7,10};
  int UFP=0,F=0,rating,i,j;
  char func_units[][30]={"External Inputs","External Outputs","External Enquiries","Internal Logical Files","External Interface Files"};
  char complexity[3][10]={"low","average","high"};
  int input[5][3];
  float FP,CAF;

  clrscr();

  for(i=0;i<5;i++)
  {
    for(j=0;j<3;j++)
    {
      printf("
Enter number of %s %s : ",complexity[j],func_units[i]);
      scanf("%d",&input[i][j]);
    }
  }

  //calculating UFP

  for(i=0;i<5;i++)
  {
    for(j=0;j<3;j++)
    {
      UFP=UFP+(input[i][j]*weights[i][j]);
    }
  }

  printf("
Unadjusted Function Point(UFP) = %d",UFP);

  printf("
Enter Rating of 14 factors on the scale of 0-5 :
");
  printf("
0 - No Influence");
  printf("
1 - Incidental");
  printf("
2 - Moderate");
  printf("
3 - Average");
  printf("
4 - Significant");
  printf("
5 - Essential");

  printf("
");

  for(i=0;i<14;i++)
  {
    scanf("%d",&rating);
    F=F+rating;
  }

  CAF=0.65+0.01*F;

  FP=UFP*CAF;

  printf("
Adjusted Function Point = %f",FP);
  printf("
OR FP = %d",fround(FP));

getch();
}


Related Posts by Categories

0 comments:

Post a Comment


Blog Archive

Powered by Blogger.