0% found this document useful (0 votes)
163 views

Flames in Java

This document contains code for a Java program that takes in two names as input and performs the FLAMES analysis on the names to determine their relationship. It initializes variables, gets the names as input, removes matching characters between the names, counts the remaining characters, iterates through the FLAMES string to determine the result, and prints out the result.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
163 views

Flames in Java

This document contains code for a Java program that takes in two names as input and performs the FLAMES analysis on the names to determine their relationship. It initializes variables, gets the names as input, removes matching characters between the names, counts the remaining characters, iterates through the FLAMES string to determine the result, and prints out the result.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import java.io.

*;
import java.lang.*;
Class flames
{
public static viod main(String arg[]) throws IO Exception
{
String a;
String b;
String fl="flames"
int l,m,i,j,ii,jj,aaa=0,bbb=0,count,t,r;
char aa[]=new char[30];
char bb[]=new char[30];
char f[]=new char[30];
Buffered Reader n=new Buffered Reader(new Input stream reader
(System.in));
System.out.println("Enter the First name");
a=n.readline();
System.out.println("Enter the Second name");
b=n.readline();
l=a.length();
m=b.length();
for(i=0;i<l;i++)
{
aa[i]=a.charAt(i);
}
for(j=0;j<m;j++)
{
bb[i]=b.charAt(j);
}
for(i=0;i<l;I++)
{
for(j=0;j<m;j++)
{
if(aa[i]==bb[j])
aa[i]=0;
bb[j]=0;
}
}
}
for(i=0;i<l;i++)
{
if(aa[i]>0)
{
aaa++;
}
}
for(j=0;j<m;j++)
{
if(bb[j]>0)
{
bbb++;
}
}
Count =aaa+bbb;
for(i=1;i<=6;i++)
{
f[i]=fl.charAt(i-1);
}
i=1;
for(t=0;t<5;t++)
{
For(r=1;r<=count;r++)
{
if(f[i]>0)
{
if(r==count)
{
f[i]=0;
}
if(i==6)
{
i=0;
}
i++;
}
Else
{
If(i==6)
{
i=0;
}
i++;
r--;
}
}
}
for(i=1;i<=6;i++)
{
Switch(f[i])
{
case "f":
system.out.println("Friend");
break;
case "l":
system.out.println("Love");
break;
case "a":
system.out.println("Affection");
break;
case "m":
system.out.println("Marrage");
break;
case "e":
system.out.println("Enemy");
break;
case "s":
system.out.println("Sister");
break;
}
}
}
112 }

You might also like