public void FLAMES()
{
name1 = new StringBuffer(firstName.getText());
name2 = new StringBuffer(secondName.getText());
for (int i = 0; i < name1.length(); i++)
{
char ch = name1.charAt(i);
for (int j = 0; j < name2.length(); j++)
{
if (ch == name2.charAt(j))
{
name1.deleteCharAt(i);
name2.deleteCharAt(j);
i = -1;
break;
}
}
}
int totallength = name1.length() + name2.length();
StringBuffer str = new StringBuffer("FLAMES");
int cancel_value = 1;
for (int i = 0; i < 5; i++)
{
cancel_value = totallength % str.length();
if (cancel_value == 0)
{
cancel_value = str.length();
}
cancel_value--;
if (cancel_value == 0)
{
str = new StringBuffer(str.substring(1));
} else if (cancel_value == (str.length() - 1))
{
str = new StringBuffer(str.substring(0, str.length() - 1));
} else
str = new StringBuffer(str.substring(cancel_value + 1)
+ str.substring(0, cancel_value));
}
just.setVisible(true);
Output.setText(relation(str.charAt(0)));
}
I GOT A LITTLE CONFUSE HERE.. IN A SCRATCH PAPER I TRY TO SOLVE A COUPLE'S NAME
WHICH IS THE FIRST NAME IS "JEROME PAMPOSA" AND THE 2ND ONE IS "JOAN VILLAR"
IN MY PROGRAM.. THE RESULT OF THE COUPLE IS "A" which means "AFFECTION" but in my
SCRATCH PAPER.. THE RESULT IS "E" which means "ENEMY".. so.. im very confuse why is my program
not match in my scratch result.. i search many sites but the codes was the same.. but if u will do
the flames game in a paper.. its different between the program and the manual procedure..
can anyone help me? thanks in advance