import java.util.Scanner;
public class textCustomerBiz {
String[] names=new String[30];
public void addName(String name){
for(int i=0;i
names[i]=name;
break;
}
}
}
public void showNames(){
for(int i=0;i
System.out.print(names[i]+"\t");
}
}
}
public boolean editName(String oldName,String newName){
boolean flag=false;
for(int i=0;i
names[i]=newName;
flag=true;
break;
}
}
return flag;
}
//textCustomerBiz
public static void main(String[]arg){
textCustomerBiz cb=new textCustomerBiz();
Scanner input=new Scanner(System.in);
for(int i=0;i
String name=input.next();
cb.addName(name);
cb.showNames();
System.out.println("继续吗y/n");
String yn=input.next();
if(yn.equals("n")){
break;
}
}
cb.showNames();
System.out.println("请输入要修改的客户姓名:");
String oldName=input.next();
System.out.println("请输入新的姓名:");
String newName=input.next();
System.out.println("修改结果");
if(cb.editName(oldName, newName)){
System.out.println("修改成功");
}else{
System.out.println("修改失败");
}
}
}