Thursday, 19 February 2015

FLAMES CALCULATOR PROGRAM IN JAVA

/*
Many of us in schooling did this manually but not by coding here is a program for u all.


                                                                     ...................Happy Coding


*/

package flame;
import java.io.IOException;
import java.util.Scanner;

public class Flame {
    public int k;
    public void i2(int y)
   {
     k=y;
if(k==2||k==4||k==7||k==9||k==20||k==22||k==25||k==2||k==4)
{System.out.println("             ENEMIES                                 ");}
else if(k==3||k==5||k==14||k==16||k==18||k==23)
{System.out.println("             FRIENDS                                ");}
else if( k==10||k==19)
{System.out.println("             LOVE                                ");}
else if
(k==12||k==8||k==13||k==17||k==28||k==30)
{System.out.println("             AFFECTION                                 ");}
else if
(k==6||k==11||k==15||k==26)
{System.out.println("            MARRIAGE                             ");}
else if(k==0)
{System.out.println("  NAMES ARE EQUAL      " );  }

else
{System.out.println("             SISTER                                 ");}

   }

public static void main(String args[])throws IOException
   {
int c,d,e,k,h,i,j,as1,as2;char i1,z,o;
 Flame f =new Flame();
    try{
          int u=0;
Scanner in=new Scanner(System.in);
System.out.println("enter names which u want to find relation");

StringBuffer f1=new StringBuffer(in.nextLine()) ;
StringBuffer g=new StringBuffer(in.nextLine()) ;
c=f1.length();
         d=g.length();

          for(int r1=0;r1<c;r1++)
          {
  as1=f1.charAt(r1);
  if((as1>=97&&as1<=122)||(as1>=65&&as1<=90)){u=u;}
  else{u=u+1;}
          }
          for(int r2=0;r2<d;r2++)
          {
  as2=g.charAt(r2);
  if((as2>=97&&as2<=122)||(as2>=65&&as2<=90)){u=u;}
  else{u=u+1;}
          }
          if(u==0)
          {
              e=c+d;
     h=0;
   for(i=0;i<c;i++)
     { for(j=0;j<d;j++)
   {
    if(f1.charAt(i)==g.charAt(j))
      {h++; f1.setCharAt(i,'Z');g.setCharAt(j,'o'); }
    else
        {h=h;}
   }
     }

  k=e-(2*h);
 
  f.i2(k);
 
          }
 
            else
           {
    System.out.println("  RELATION CANNOT BE DETERMINED ");
  }
       }

catch (Exception di)
{
 
   System.out.println(" RELATION CANNOT BE DETERMINED ");
   System.out.println(di);
}
     }  
}

No comments:

Post a Comment