//personid必须为正整数
if (person_id.equals("")||estimate(person_id)== 0) {
System.out.println(
"personid must be digital and bigger than 0!");
flag=1;
return;
}
//if (person_id == "1")
if (Integer.parseInt(person_id) == 1) {
System.out.println(
"Duplicate personid,this person has been existed! ");
flag=2;
return;
}
//Test whether personname is blank
if (person_name.equals("")) {
System.out.println(
"personname must be input!");
flag=3;
return;
}
//Test whether personsex is 'm' or 'f'
if (!person_sex.equals("m") && !person_sex.equals("f")) {
System.out.println("Invalide input ,personsex must be 'm' or 'f'!");
flag=4;
return;
}
System.out.println(
"' " + person_name + " ' has been added successfully");
flag=0;