package Thirdweek;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Tongxunlu {
public static void main(String[] args) {
boolean flag=true;
Person1 p = new Person1();
do {
System.out.println("************************");
System.out.println("****1.查询所有联系人信息****");
System.out.println("****2.根据id查询联系人****");
System.out.println("****3.根据姓名查询联系人****");
System.out.println("****4.根据分组查询联系人1.家人2.朋友 3.同事****");
System.out.println("****5.添加联系人1.家人2.朋友3.同事****");
System.out.println("****6.根据id删除联系人****");
System.out.println("****7.根据id修改联系人****");
System.out.println("****8.清空联系人****");
System.out.println("************************");
System.out.println("请输入想要操作的指令:");
Scanner sc=new Scanner(System.in);
int i=sc.nextInt();
List<Person2> list = new ArrayList<>();
switch(i) {
case 1:{
p.bianli();
}break;
case 2:{
p.findById();
}break;
case 3:{
p.findByName();
}break;
case 4:{
p.findByGroup();
}break;
case 5:{
p.addPerson();
}break;
case 6:{
p.deletById();
}break;
case 7:{
p.modifyById();
}break;
case 8:{
p.clearPerson();
}break;
default:flag=false;break;
}
}while(flag);
}
}
class Person1{
String name;
String tel;
List<Person1> list = new ArrayList<>();
List<Family> list1 = new ArrayList<>();
List<Friend> list2 = new ArrayList<>();
List<Colleague> list3 = new ArrayList<>();
private String address;
private String position;
public Person1(String n, String t) {
// TODO Auto-generated constructor stub
}
//toString
@Override
public String toString() {
return "Person1 [name=" + name + ", tel=" + tel + ", list=" + list + "]";
}
//无参构造
public Person1() {
}
//get set
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTel() {
return tel;
}
public void setTel(String tel) {
this.tel = tel;
}
public List<Person1> getList() {
return list;
}
public void setList(List<Person1> list) {
this.l
2020-11-27
最新推荐文章于 2024-05-13 05:16:19 发布