Project3开发人员调度软件

🎈目标

  • 模拟实现一个基于文本界面的《开发团队调度软件》
  • 熟悉Java面向对象的高级特性,进一步掌握编 程技巧和调试技巧
  • 主要涉及以下知识点:
    1. 类的继承性和多态性
    2. 对象的值传递、接口
    3. static和final修饰符
    4. 特殊类的使用:包装类、抽象类、内部类
    5. 异常处理

🎈需求说明

  • 该软件实现以下功能:
    1. 软件启动时,根据给定的数据创建公司部分成员列表(数组)
    2. 根据菜单提示,基于现有的公司成员,组建一个开发团队以开发一个新的项目
    3. 组建过程包括将成员插入到团队中,或从团队中删除某成员,还可以列出团队中现有成员的列表
    4. 开发团队成员包括架构师、设计师和程序员

⭐软件结构

该软件由以下三个模块组成:

  • com.atguigu.team.view模块为主控模块,负责菜单的显示和处理用户操作
  • com.atguigu.team.service模块为实体对象(Employee及其子类如程序员等)的管理模块, NameListService和TeamService类分别用各自的数组来管理公司员工和开发团队成员对象
  • domain模块为Employee及其子类等JavaBean类所在的包

🎈domain

✨Architect.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package src.SUMMER_java.project_3.domain;

public class Architect extends Designer {// ??????
private int stock;

public int getStock() {
return stock;
}

public void setStock(int stock) {
this.stock = stock;
}

Architect() {
super();
}

public Architect(int id, int age, String name, double salary, Equipment equipment, double bonus, int stock) {
super(id, age, name, salary, equipment, bonus);
this.stock = stock;
}

public String getDetailsForTeam() {
return getMemberDetails() + "\t架构师\t" +
getBonus() + "\t" + getStock();
}

@Override
public String toString() {
return getDetails() + "架构师\t" + getStatus() + "\t" +
getBonus() + "\t" + getStock() + "\t" + getEquipment().getDescription();
}
}

✨Designer.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package src.SUMMER_java.project_3.domain;

public class Designer extends Programmer {
private double bonus;

public double getBonus() {
return bonus;
}

public void setBonus(double bonus) {
this.bonus = bonus;
}

public Designer(int id, int age, String name, double salary,
Equipment equipment, double bonus) {
super(id, age, name, salary, equipment);
this.bonus = bonus;
}

Designer() {
super();
}

public String getDetailsForTeam() {
return getMemberDetails() + "\t设计师\t" + getBonus();
}

@Override
public String toString() {
return getDetails() + "\t设计师\t" + getStatus() + "\t" +
getBonus() + "\t\t" + getEquipment().getDescription();
}
}

✨Programmer.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package src.SUMMER_java.project_3.domain;

import src.SUMMER_java.project_3.service.*;

public class Programmer extends Employee { // coder
private int memberId;
private Status status = Status.FREE; // todo NOTICE
// FREE-空闲
// BUSY-已加入开发团队
// VOCATION-正在休假
private Equipment equipment;

public Programmer(int id, int age, String name, double salary, Equipment equipment) {
// Constructor call must be the first statement in a constructor
super(id, age, name, salary);
this.equipment = equipment;
}

public Programmer() {
}

public int getMemberId() {
return memberId;
}

public void setMemberId(int memberId) {
this.memberId = memberId;
}

public Status getStatus() {
return status;
}

public void setStatus(Status status) {
this.status = status;
}

public Equipment getEquipment() {
return equipment;
}

public void setEquipment(Equipment equipment) {
this.equipment = equipment;
}

protected String getMemberDetails() {
return getMemberId() + "/" + getDetails();
}

public String getDetailsForTeam() {
return getMemberDetails() + "\t程序员";
}

@Override
public String toString() {
return getDetails() + "\t程序员\t" + status + "\t" + equipment.getDescription();
}
}

✨Employee.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package src.SUMMER_java.project_3.domain;

public class Employee {
private int id;
private String name;
private int age;
private double salary;

public int getAge() {
return age;
}

public int getId() {
return id;
}

public String getName() {
return name;
}

public double getSalary() {
return salary;
}

public void setAge(int age) {
this.age = age;
}

public void setId(int id) {
this.id = id;
}

public void setName(String name) {
this.name = name;
}

public void setSalary(double salary) {
this.salary = salary;
}

public Employee(int id, int age, String name, double salary) {
this.age = age;
this.name = name;
this.salary = salary;
this.id = id;
}

public Employee() {

}

protected String getDetails() {
return id + "\t" + name + "\t" + age + "\t" + salary;
}

@Override
public String toString() {
return getDetails();
}
}

✨Equipment.java

1
2
3
4
5
6
package src.SUMMER_java.project_3.domain;

public interface Equipment {
String getDescription();
}

✨NoteBook.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package src.SUMMER_java.project_3.domain;

public class NoteBook implements Equipment {
private String model;// 机器型号
private double price;// 机器价格

public String getModel() {
return model;
}

public double getPrice() {
return price;
}

public void setModel(String model) {
this.model = model;
}

public void setPrice(double price) {
this.price = price;
}

NoteBook() {

}

public NoteBook(String m, double p) {
super();
model = m;
price = p;
}

public String getDescription() {
return model + "(" + price + ")";
}
}

✨PC.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package src.SUMMER_java.project_3.domain;

public class PC implements Equipment {
private String model;// 机器型号
private String display;// 显示器名称

public String getModel() {
return model;
}

public void setDisplay(String display) {
this.display = display;
}

public String getDisplay() {
return display;
}

public void setModel(String model) {
this.model = model;
}

@Override
public String getDescription() {
return model + "( " + display + " )";
}

public PC(String model, String display) {
this.display = display;
this.model = model;

}
}

✨Data.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package src.SUMMER_java.project_3.domain;

public class Data {
public static final int EMPLOYEE = 10;
public static final int PROGRAMMER = 11;
public static final int DESIGNER = 12;
public static final int ARCHITECT = 13;

public static final int PC = 21;
public static final int NOTEBOOK = 22;
public static final int PRINTER = 23;

// Employee : 10, id, name, age, salary
// Programmer: 11, id, name, age, salary
// Designer : 12, id, name, age, salary, bonus
// Architect : 13, id, name, age, salary, bonus, stock
public static final String[][] EMPLOYEES = {
{ "10", "1", "马云", "22", "3000" },
{ "13", "2", "马化腾", "32", "18000", "15000", "2000" },
{ "11", "3", "李彦宏", "23", "7000" },
{ "11", "4", "刘强东", "24", "7300" },
{ "12", "5", "雷军", "28", "10000", "5000" },
{ "11", "6", "任志强", "22", "6800" },
{ "12", "7", "柳传志", "29", "10800", "5200" },
{ "13", "8", "杨元庆", "30", "19800", "15000", "2500" },
{ "12", "9", "史玉柱", "26", "9800", "5500" },
{ "11", "10", "丁磊", "21", "6600" },
{ "11", "11", "张朝阳", "25", "7100" },
{ "12", "12", "杨致远", "27", "9600", "4800" }
};

// 如下的EQUIPMENTS数组与上面的EMPLOYEES数组元素一一对应
// PC :21, model, display
// NoteBook:22, model, price
// Printer :23, name, type
public static final String[][] EQUIPMENTS = {
{},
{ "22", "联想T4", "6000" },
{ "21", "戴尔", "NEC17寸" },
{ "21", "戴尔", "三星 17寸" },
{ "23", "佳能 2900", "激光" },
{ "21", "华硕", "三星 17寸" },
{ "21", "华硕", "三星 17寸" },
{ "23", "爱普生20K", "针式" },
{ "22", "惠普m6", "5800" },
{ "21", "戴尔", "NEC 17寸" },
{ "21", "华硕", "三星 17寸" },
{ "22", "惠普m6", "5800" }
};
}

✨Printer.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package src.SUMMER_java.project_3.domain;

public class Printer implements Equipment {
private String type;
private String name;

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

Printer() {
}

public Printer(String type, String name) {
super();
this.name = name;
this.type = type;
}

@Override
public String getDescription() {
return name + "( " + type + " )";
}
}

🎈Service

✨NameListService.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package src.SUMMER_java.project_3.service;

import src.SUMMER_java.project_3.domain.*;
import static src.SUMMER_java.project_3.domain.Data.*;
//导入Data 下所有的静态结构 :employee = new Employee[Data.EMPLOYEES.length];

public class NameListService {
// 负责将Data中的数据分装到Employee[] 中,同时提供相应的Employee[] method
public static Employee[] employees;

public NameListService() {
// 根据Data类中的数据构建不同的对象,包括employee,Programmer,Designer,Architect
// 将对象存于数组中
employees = new Employee[EMPLOYEES.length];
// todo employee = new Employee[Data.EMPLOYEES.length];
for (int i = 0; i < employees.length; i++) {
int type = Integer.parseInt(EMPLOYEES[i][0]);
// todo 提前获取属性
int id = Integer.parseInt(EMPLOYEES[i][1]);
String name = EMPLOYEES[i][2];
int age = Integer.parseInt(EMPLOYEES[i][3]);
double salary = Double.parseDouble(EMPLOYEES[i][4]);
switch (type) {
case EMPLOYEE:
employees[i] = new Employee(id, age, name, salary);
break;
case PROGRAMMER:
Equipment equipment_PROGRAMMER = createEquipment(i); // 获取 equipment
employees[i] = new Programmer(id, age, name, salary, equipment_PROGRAMMER);
break;
case DESIGNER:
Equipment equipment_DESIGNER = createEquipment(i);
double bonus_DESIGNER = Double.parseDouble(EMPLOYEES[i][5]);
employees[i] = new Designer(id, age, name, salary, equipment_DESIGNER, bonus_DESIGNER);
break;
case ARCHITECT:
double bonus_ARCHITECT = Double.parseDouble(EMPLOYEES[i][5]);
Equipment equipment_ARCHITECT = createEquipment(i);
int stock = Integer.parseInt(EMPLOYEES[i][6]);
employees[i] = new Architect(id, age, name, salary, equipment_ARCHITECT, bonus_ARCHITECT, stock);
break;
}
}
}

/**
* @return Employee[]
*/
public Employee[] getAllEmployees() {
return employees;
}

/**
* @param ID
* @return Employee[]i
* @throws Exception
*/
public Employee getEmployees(int ID) throws Exception {

for (int i = 0; i < employees.length + 1; i++) {
if (employees[i].getId() == ID) {
return employees[i];
}
}
throw new TeamException("The specified employee could not be found");
}

/**
* @Description 获取指定index上的员工的设备
* @param i
* @return Equipment
*
*/
public static Equipment createEquipment(int idx) { // 获取指定id 的equipment
int type = Integer.parseInt(EQUIPMENTS[idx][0]); // 通过数字判断 类型
switch (type) {
case PC:// 21
return new PC(EQUIPMENTS[idx][1], EQUIPMENTS[idx][2]);
case NOTEBOOK: // Data.NOTEBOOK 22
return new NoteBook(EQUIPMENTS[idx][1], Double.parseDouble(EQUIPMENTS[idx][2]));
case PRINTER:// Data.PRINTER 23
return new Printer(EQUIPMENTS[idx][1], EQUIPMENTS[idx][2]);

}
return null;
}

}

✨Status.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package src.SUMMER_java.project_3.service;

public class Status {

private final String NAME;

private Status(String name) {
this.NAME = name;
}

public static final Status FREE = new Status("FREE");
public static final Status BUSY = new Status("BUSY");
public static final Status VOCATION = new Status("VOCATION");

public String getNAME() {
return NAME;
}

public String toString() {
return NAME;
}
}
// Status是项目service包下自定义的类,
// 声明三个对象属性,分别表示成员的状态。
// FREE-空闲
// BUSY-已加入开发团队
// VOCATION-正在休假

✨TeamException.java

1
2
3
4
5
6
7
8
9
10
package src.SUMMER_java.project_3.service;

public class TeamException extends Exception {
static final long serialVersionUID = -3387516947546229948L;

public TeamException(String ms) {
super(ms);
}
}

✨TeamService.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package src.SUMMER_java.project_3.service;
//关于开发团队成员的管理:添加、删除等。

import src.SUMMER_java.project_3.domain.Architect;
import src.SUMMER_java.project_3.domain.Designer;
import src.SUMMER_java.project_3.domain.Employee;
import src.SUMMER_java.project_3.domain.Programmer;

public class TeamService {
public TeamService() {
}

private static int counter = 1;
private static final int MAX_MEMBER = 5;
private Programmer[] team = new Programmer[MAX_MEMBER]; // 保存开发团队成员
private int total; // record real person num

public Programmer[] getTeam() {
Programmer[] temp = new Programmer[total];
for (int i = 0; i < total; i++) {
temp[i] = team[i];
}
return temp;
}

/**
* 将指定的员工添加到团队中
*
* @param memberId
* @throws TeamException
* 成员已满,无法添加
* 该成员不是开发人员,无法添加
* 该员工已在本开发团队中
* 该员工已是某团队成员
* 该员正在休假,无法添加
* 团队中至多只能有一名架构师
* 团队中至多只能有两名设计师
* 团队中至多只能有三名程序员
*
*/

public void addMember(Employee e) throws TeamException {// 添加员工
if (total >= MAX_MEMBER)
throw new TeamException("成员已满,无法添加");

if (!(e instanceof Programmer))
throw new TeamException("成员不是开发人员,无法添加");
if (isExist(e))
throw new TeamException("成员已加入团队,无法添加");
Programmer p = (Programmer) e;
if (p.getStatus().getNAME().equals("BUSY")) {
throw new TeamException("成员已是某团队成员,无法添加");
} else if (p.getStatus().getNAME().equals("VOCATION"))
throw new TeamException("成员VOCATION,无法添加");
// 1 架构师 2 设计师 3 程序员
int numOfArh = 0, numOfDes = 0, numOfPro = 0;
for (int i = 0; i < total; i++) {
if (team[i] instanceof Architect)
numOfArh++;
else if (team[i] instanceof Designer)
numOfDes++;
else
numOfPro++;
}
if (p instanceof Architect) {
if (numOfArh >= 1)
throw new TeamException(" 架构师 should <=1,无法添加");
} else if (p instanceof Designer)
if (numOfDes >= 2)
throw new TeamException(" 设计师 should <=2,无法添加");
else if (p instanceof Programmer)
if (numOfPro >= 3)
throw new TeamException(" 程序员 should <=3,无法添加");

team[total++] = p;
p.setStatus(Status.BUSY);
p.setMemberId(counter++);
}

/**
* @param memberId
* @throws TeamException
* 当选择“删除团队成员”菜单时,将执行从开发团队中删除指定(通过TeamID)成员的功能:
*
* 1-团队列表 2-添加团队成员 3-删除团队成员 4-退出 请选择(1-4):3
*
*/
public void removeMember(int memberId) throws TeamException {
if (!isExist(memberId)) { // 员工未加入本团队
throw new TeamException("找不到指定memberId的员工,删除失败");
}
int i;
for (i = 0; i < total; i++) {
if (team[i].getMemberId() == memberId) {
team[i].setStatus(Status.FREE);
// public static final Status FREE=new Status("FREE");
for (int j = i; j < total - 1; i++) {
team[j] = team[j + 1];
}
total--;
}
}
// todo if(i==total ) 也是没找到

}

private boolean isExist(Employee e) { // 判断员工是否已加入本团队
for (int i = 0; i < total; i++) {
if (team[i].getName() == e.getName())
return true;
}
return false;
}

private boolean isExist(int memberId) { // 判断员工是否已加入本团队
for (int i = 0; i < total; i++) {
if (team[i].getMemberId() == memberId)
return true;
}
return false;
}

}

✨TSUtility工具类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package src.SUMMER_java.project_3.service;

import java.util.*;

/**
*
* @Description 项目中提供了TSUtility.java类,可用来方便地实现键盘访问。
* @author shkstart Email:shkstart@126.com
* @version
* @date 2019年2月12日上午12:02:58
*
*/
public class TSUtility {
private static Scanner scanner = new Scanner(System.in);

/**
*
* @Description 该方法读取键盘,如果用户键入’1’-’4’中的任意字符,则方法返回。返回值为用户键入字符。
* @author shkstart
* @date 2019年2月12日上午12:03:30
* @return
*/
public static char readMenuSelection() {
char c;
for (;;) {
String str = readKeyBoard(1, false);
c = str.charAt(0);
if (c != '1' && c != '2' &&
c != '3' && c != '4') {
System.out.print("选择错误,请重新输入:");
} else
break;
}
return c;
}

/**
*
* @Description 该方法提示并等待,直到用户按回车键后返回。
* @author shkstart
* @date 2019年2月12日上午12:03:50
*/
public static void readReturn() {
System.out.print("按回车键继续...");
readKeyBoard(100, true);
}

/**
*
* @Description 该方法从键盘读取一个长度不超过2位的整数,并将其作为方法的返回值。
* @author shkstart
* @date 2019年2月12日上午12:04:04
* @return
*/
public static int readInt() {
int n;
for (;;) {
String str = readKeyBoard(2, false);
try {
n = Integer.parseInt(str);
break;
} catch (NumberFormatException e) {
System.out.print("数字输入错误,请重新输入:");
}
}
return n;
}

/**
*
* @Description 从键盘读取‘Y’或’N’,并将其作为方法的返回值。
* @author shkstart
* @date 2019年2月12日上午12:04:45
* @return
*/
public static char readConfirmSelection() {
char c;
for (;;) {
String str = readKeyBoard(1, false).toUpperCase();
c = str.charAt(0);
if (c == 'Y' || c == 'N') {
break;
} else {
System.out.print("选择错误,请重新输入:");
}
}
return c;
}

private static String readKeyBoard(int limit, boolean blankReturn) {
String line = "";

while (scanner.hasNextLine()) {
line = scanner.nextLine();
if (line.length() == 0) {
if (blankReturn)
return line;
else
continue;
}

if (line.length() < 1 || line.length() > limit) {
System.out.print("输入长度(不大于" + limit + ")错误,请重新输入:");
continue;
}
break;
}

return line;
}
}

🎈View

✨TeamView.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
package src.SUMMER_java.project_3.view;

import src.SUMMER_java.project_3.domain.Employee;
import src.SUMMER_java.project_3.domain.Programmer;
import src.SUMMER_java.project_3.service.NameListService;
import src.SUMMER_java.project_3.service.TSUtility;
import src.SUMMER_java.project_3.service.TeamException;
import src.SUMMER_java.project_3.service.TeamService;

public class TeamView {
// +enterMainMenu(): void
// - listAllEmployees(): void
// - getTeam():void
// - addMember(): void
// - deleteMember(): void
// + main(args: String[]) : void
// - listSvc: NameListService = new NameListService()
// - teamSvc: TeamService = new TeamService()
public void enterMainMenu() {
boolean loopFlag = true;
listAllEmployees();
char key = 0;
while (loopFlag) {
System.out.print("1-团队列表 2-添加团队成员 3-删除团队成员 4-退出 请选择(1-4):");
key = TSUtility.readMenuSelection();
if (key != '1') // key =='1' show Teamlist key!= '1' show allEmployeeList
listAllEmployees();
switch (key) {
case '1':
listTeam();
break;

case '2':
addMember();
break;

case '3':
deleteMember();
break;

case '4':
loopFlag = Out();
break;

}
}
// System.out.println("ID\t姓名\t年龄\t年龄\t年龄\t年龄\t年龄\t年龄\t");

}

public void listAllEmployees() {
System.out.println("\n-------------------------------开发团队调度软件--------------------------------\n");
Employee[] emps = listSvc.getAllEmployees();
if (emps == null || emps.length == 0) {
System.out.println("没有客户记录!");
} else {
System.out.println("ID\t姓名\t年龄\t工资\t职位\t状态\t奖金\t股票\t领用设备");
}

for (Employee e : emps) {
System.out.println(" " + e);
}
System.out.println("-------------------------------------------------------------------------------");

}

private void listTeam() {
System.out.println("\n--------------------团队成员列表---------------------\n");
Programmer[] team = teamSvc.getTeam();
if (team.length == 0) {
System.out.println("开发团队目前没有成员!");
} else {
System.out.println("TID/ID\t姓名\t年龄\t工资\t职位\t奖金\t股票");
}
for (Programmer p : team) {
System.out.println(" " + p.getDetailsForTeam());
}
System.out.println("-----------------------------------------------------");
}

private void addMember() {
System.out.println("---------------------添加成员---------------------");

System.out.println("请输入添加成员的ID");
int ID = TSUtility.readInt();
Employee emp;
try {
emp = listSvc.getEmployees(ID);
teamSvc.addMember(emp);

} catch (Exception e) {
System.out.println("添加失败,原因: " + e.getMessage());
}
TSUtility.readReturn();

}

private void deleteMember() {
System.out.println("---------------------删除成员---------------------");
Programmer[] team = teamSvc.getTeam();
if (team.length == 0) {
System.out.println("开发团队目前没有成员!");
return;
}
System.out.print("请输入要删除员工的TID:");
int TID = TSUtility.readInt();
System.out.print("确认是否删除(Y/N):");
char yn = TSUtility.readConfirmSelection();
if (yn == 'N')
return;
try {
teamSvc.removeMember(TID);
System.out.println("删除成功");
} catch (TeamException e) {
System.out.println("删除失败,原因: " + e.getMessage());

}
}

/**
* @return boolean
* @Decision if confirm to out the System
*/
private boolean Out() {
System.out.println("是否要退出? (Y or N)?");
char select = TSUtility.readConfirmSelection();
if (select == 'Y')
return false;
return true;
}

private NameListService listSvc = new NameListService();
TeamService teamSvc = new TeamService();

/**
* 主菜单
*
* @param args
*/
public static void main(String[] args) {
TeamView m = new TeamView();
m.enterMainMenu();
}
}