日期:2014-05-20  浏览次数:20662 次

用Vector写了个通讯录,提示找不到符号、不兼容的类型,求指教
新学习Java,用Vector写了个通讯录,但是编译的时候总是出错,求指点,感激不尽!
import java.io.*;
import java.util.Vector;
import java.util.Scanner;

public class tongxunlu1 {
//主方法
   public static void main (String[] args){
      SimpleMember tongxunList=new SimpleMember();
      int choice;
      showSelection();
      choice=GetInput.getInput();
      while(choice!=0){
 switch(choice){
    case 1: 
    tongxunList.printAllMember();
    break;
    case 2: 
    tongxunList.InputMember();
    break;
    case 3: 
    tongxunList.searchMember();
    break;
    case 4: 
    tongxunList.dMember();
    break;
    case 5: 
    tongxunList.chMember();
    break;
    default:System.out.println("Invalid selection");
 }
 System.out.println("\n");
 showSelection();
      choice=GetInput.getInput();
      }
   }

//输入主界面
   public static void showSelection () {
      System.out.println("**********************");
      System.out.println("  1.显示所有的通讯人");
      System.out.println("  2.添加新的通讯人");
      System.out.println("  3.查找通讯人");
      System.out.println("  4.删除通讯人");
      System.out.println("  5.修改通讯人");
      System.out.println("  0.退出");
      System.out.println("**********************");
   }
}

//输入选择项
class GetInput{
   public static int getInput() {
      System.out.println("请输入:");
      Scanner scanner=new Scanner(System.in);
      int str=scanner.nextInt();
      return str;
   }
}

class SimpleMember {
   public Vector memberList=new Vector();
   public Vector member=new Vector();

//输入
   String InputSth(String Sth1,String Sth2) {
      String str;
      Scanner scanner=new Scanner(System.in);
      System.out.println("请输入需要"+Sth1+"的人的"+Sth2);
      str=scanner.next();
      return str;
   }
//打印链表中的所有成员
   void printAllMember(){
      int memberNum;
      memberNum=memberList.size();
      System.out.println("该通讯录中共有"+"memberNum"+"个条目");
      System.out.println(memberList);
   }