Вы находитесь на странице: 1из 19

NAME:R.

UMAMAHESWARI

REGNO:13MSE0285

SOFTWARE METRICS LAB

Functionpoint code:

import java.util.Scanner;

class fp

public static void main(String args[])

Scanner s = new Scanner(System.in);

int Ei,Eo,Eq,Eif,Ilf,ftr,det,i,upf=0;

System.out.println("Enter the External input count: ");

Ei=s.nextInt();

System.out.println("Enter the External output count: ");

Eo=s.nextInt();

System.out.println("Enter the External inquiries count: ");

Eq=s.nextInt();

System.out.println("Enter the External interface count: ");

Eif=s.nextInt();

System.out.println("Enter the Internal logic count: ");

Ilf=s.nextInt();

//External Input Loop

for(i=1;i<=Ei;i++)

{
System.out.println("Enter the FTR and DET values for "+i+"th External Input");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>=1)&&(det<5))

upf+=3;

else if((det>4)&&(det<16))

upf+=3;

else

upf+=4;

else if(ftr==2)

if((det>=1)&&(det<5))

upf+=3;

else if((det>4)&&(det<16))

upf+=4;

else

upf+=6;

else

if((det>=1)&&(det<5))

upf+=4;

else if((det>4)&&(det<16))

upf+=6;
else

upf+=6;

//External Output Loop

for(i=1;i<=Eo;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Output");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>=1)&&(det<=5))

upf+=4;

else if((det>5)&&(det<20))

upf+=4;

else

upf+=5;

else if((ftr==2)&&(ftr==3))

if((det>=1)&&(det<=5))

upf+=4;

else if((det>5)&&(det<20))

upf+=5;

else
upf+=7;

else

if((det>=1)&&(det<=5))

upf+=5;

else if((det>5)&&(det<20))

upf+=7;

else

upf+=7;

//External Inquiries loop

for(i=1;i<=Eq;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Inquiries");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>=1)&&(det<=5))

upf+=3;

else if((det>5)&&(det<20))

upf+=3;

else

upf+=4;
}

else if((ftr==2)&&(ftr==3))

if((det>=1)&&(det<=5))

upf+=3;

else if((det>5)&&(det<20))

upf+=4;

else

upf+=6;

else

if((det>=1)&&(det<=5))

upf+=4;

else if((det>5)&&(det<20))

upf+=6;

else

upf+=6;

//External Interface loop

for(i=1;i<=Eif;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Interface");

ftr=s.nextInt();

det=s.nextInt();
if(ftr==1)

if((det>=1)&&(det<20))

upf+=5;

else if((det>19)&&(det<51))

upf+=5;

else

upf+=7;

else if((ftr>=2)&&(ftr<=5))

if((det>=1)&&(det<20))

upf+=5;

else if((det>19)&&(det<51))

upf+=7;

else

upf+=10;

else

if((det>=1)&&(det<20))

upf+=7;

else if((det>19)&&(det<51))

upf+=10;

else

upf+=10;

}
}

//Internal Logic loop

for(i=1;i<=Ilf;i++)

System.out.println("Enter the FTR and DET values for "+i+"th Internal Logic");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>0)&&(det<20))

upf+=7;

else if((det>19)&&(det<51))

upf+=7;

else

upf+=10;

else if((ftr>=2)&&(ftr<=5))

if((det>0)&&(det<20))

upf+=7;

else if((det>19)&&(det<51))

upf+=10;

else

upf+=15;

else
{

if((det>0)&&(det<20))

upf+=10;

else if((det>19)&&(det<51))

upf+=15;

else

upf+=15;

int vaff=0;

double vaf,fp;

System.out.println("Enter the VAF score for Each Attribute (on a scale of 0-5) :");

for(i=0;i<14;i++)

int temp=s.nextInt();

vaff+=temp;

vaf=0.65+(0.01*vaff);

fp=upf*vaf;

System.out.println("\nUnadjusted Function Points = "+upf);

System.out.println("Value Adjustment Factor = "+vaf);

System.out.println("Function points = "+fp+"\n");

}
Output:

Cocomo code:

import java.util.Scanner;

class coco

public static void main(String args[])

Scanner s = new Scanner(System.in);

int Ei,Eo,Eq,Eif,Ilf,ftr,det,i,upf=0;
System.out.println("Enter the External input count: ");

Ei=s.nextInt();

System.out.println("Enter the External output count: ");

Eo=s.nextInt();

System.out.println("Enter the External inquiries count: ");

Eq=s.nextInt();

System.out.println("Enter the External interface count: ");

Eif=s.nextInt();

System.out.println("Enter the Internal logic count: ");

Ilf=s.nextInt();

//External Input Loop

for(i=1;i<=Ei;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Input");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>=1)&&(det<5))

upf+=3;

else if((det>4)&&(det<16))

upf+=3;

else

upf+=4;

else if(ftr==2)
{

if((det>=1)&&(det<5))

upf+=3;

else if((det>4)&&(det<16))

upf+=4;

else

upf+=6;

else

if((det>=1)&&(det<5))

upf+=4;

else if((det>4)&&(det<16))

upf+=6;

else

upf+=6;

//External Output Loop

for(i=1;i<=Eo;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Output");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

{
if((det>=1)&&(det<=5))

upf+=4;

else if((det>5)&&(det<20))

upf+=4;

else

upf+=5;

else if((ftr==2)&&(ftr==3))

if((det>=1)&&(det<=5))

upf+=4;

else if((det>5)&&(det<20))

upf+=5;

else

upf+=7;

else

if((det>=1)&&(det<=5))

upf+=5;

else if((det>5)&&(det<20))

upf+=7;

else

upf+=7;

}
//External Inquiries loop

for(i=1;i<=Eq;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Inquiries");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>=1)&&(det<=5))

upf+=3;

else if((det>5)&&(det<20))

upf+=3;

else

upf+=4;

else if((ftr==2)&&(ftr==3))

if((det>=1)&&(det<=5))

upf+=3;

else if((det>5)&&(det<20))

upf+=4;

else

upf+=6;

else

if((det>=1)&&(det<=5))
upf+=4;

else if((det>5)&&(det<20))

upf+=6;

else

upf+=6;

//External Interface loop

for(i=1;i<=Eif;i++)

System.out.println("Enter the FTR and DET values for "+i+"th External Interface");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>=1)&&(det<20))

upf+=5;

else if((det>19)&&(det<51))

upf+=5;

else

upf+=7;

else if((ftr>=2)&&(ftr<=5))

if((det>=1)&&(det<20))

upf+=5;
else if((det>19)&&(det<51))

upf+=7;

else

upf+=10;

else

if((det>=1)&&(det<20))

upf+=7;

else if((det>19)&&(det<51))

upf+=10;

else

upf+=10;

//Internal Logic loop

for(i=1;i<=Ilf;i++)

System.out.println("Enter the FTR and DET values for "+i+"th Internal Logic");

ftr=s.nextInt();

det=s.nextInt();

if(ftr==1)

if((det>0)&&(det<20))

upf+=7;

else if((det>19)&&(det<51))
upf+=7;

else

upf+=10;

else if((ftr>=2)&&(ftr<=5))

if((det>0)&&(det<20))

upf+=7;

else if((det>19)&&(det<51))

upf+=10;

else

upf+=15;

else

if((det>0)&&(det<20))

upf+=10;

else if((det>19)&&(det<51))

upf+=15;

else

upf+=15;

int vaff=0;

double vaf,fp;
System.out.println("Enter the VAF score for Each Attribute (on a scale of 0-5) :");

for(i=0;i<14;i++)

int temp=s.nextInt();

vaff+=temp;

vaf=0.65+(0.01*vaff);

fp=upf*vaf;

System.out.println("\nUnadjusted Function Points = "+upf);

System.out.println("Value Adjustment Factor = "+vaf);

System.out.println("Function points = "+fp+"\n");

int[] lf={320,128,105,105,90,70,30,20};

System.out.println("1. Assembly\n2. C\n3. Cobol\n4. Fortran\n5. Pascal\n6. ADA\n7. OO


Languages\n8. 4GL\n Enter your Dev Language:");

int ch=s.nextInt();

double kloc=fp*lf[ch-1]/1000;

System.out.println("\nSize= "+kloc+" KLOC");

double c,n;

if(kloc<50)

c=2.4;

n=1.05;

System.out.println("The System is organic");

else if(kloc<300)
{

c=3.0;

n=1.12;

System.out.println("The System is Semi-detached");

else

c=3.6;

n=1.2;

System.out.println("The System is Embedded");

double pm=c*Math.pow(kloc,n);

double productivity=kloc*1000/pm;

double tdev=c*Math.pow(pm,n);

double avg_staff=pm/tdev;

double cpm=kloc*1000*productivity;

double cost=cpm*tdev*avg_staff;

System.out.println("\nPerson-months ="+pm+" person-months");

System.out.println("Productivity ="+productivity+" LOC per Person-months");

System.out.println("Time of Development ="+tdev+" person-months");

System.out.println("Average staffing ="+avg_staff);

System.out.println("Cost per person per month ="+cpm);

System.out.println("Estimated Total cost ="+cost+"\n");

}
Output:

Вам также может понравиться