我正在尝试开发一个应用程序,它接受两个名字并计算它们之间的爱情百分比。 我已经在字符数组中使用了字符串LOVE,名字和姓氏,但我无法决定下一步该做什么。互联网上的任何内容都没有为我提供开始或算法。请指出我可以获得的一些网站algo for this ... THanks ...以下是我在字符数组中取字符串名称的代码
public class MainActivity extends Activity {
EditText Fname,Sname;
Button btn;
char[] L_array,F_array,S_array;
int sum=0;
int sum2=0;
String love = "LOVES";
String first_name,second_name;
private String name1;
private String name2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Fname = (EditText)findViewById(R.id.name1);
Sname = (EditText)findViewById(R.id.name2);
btn = (Button)findViewById(R.id.OkButton);
L_array = new char[love.length()];
for(int count=0;count <L_array.length;count++){
L_array[count] = love.charAt(count);
Log.e("character array", L_array[count]+ " ");
}
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
first_name = Fname.getText().toString();
second_name = Sname.getText().toString();
Log.e("FirstPerson", Fname.getText().toString());
Log.e("SecondPerson", Sname.getText().toString());
F_array = new char[Fname.length()];
S_array = new char[Sname.length()];
for(int count = 0; count <F_array.length;count++){
F_array[count] = first_name.charAt(count);
Log.e("first_name", F_array[count]+ " ");
}
for(int count = 0; count <S_array.length;count++){
S_array[count] = second_name.charAt(count);
Log.e("second_name",S_array[count]+ " ");
}
}
});