项目的具体源码,已经打包放在博客末尾Java 项目:员工管理系统搭建环境: Idea 集成开发工具技术点:数组面向对象继承多态接口异常的处理项目结构:代码示例:123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119public class TeaView { private NameLIstService lIstService = new NameLIstService(); private TeamService teamService = new TeamService(); public void enterMainMenu(){ boolean loopFlag = true; char key = 0; while(loopFlag){ if(! (key == '1')){ listAllEmployees(); } System.out.print("1-团队列表 2-添加团队成员 3-删除团队成员 4-退出 请选择(1-4):"); key = TSUtility.readMenuSelection(); System.out.println(); switch (key){ case '1': getTeam(); break; case '2': addMenber(); break; case '3': deleMember(); break; case '4': System.out.print("确认是否退出(Y/N):"); char yn = TSUtility.readConfirmSelection(); if(yn == 'Y'){ loopFlag = false; break; } } } } /** * 以表格形式列出公司所有的员工 */ public void listAllEmployees(){ System.out.println("\n--------------------开发团队调度软件---------------------\n"); Employee[] employees = lIstService.getAllEmployees(); if(employees.length == 0){ System.out.println("没有客户资料"); }else{ System.out.println("ID\t姓名\t\t年龄\t\t工资\t\t职位\t\t状态\t\t奖金\t\t股票\t\t领用设备"); } for(Employee e : employees){ System.out.println(" "+ e); } System.out.println("-------------------------------------------------------------------------------"); } /** * 显示团队成员列表操作 */ public void getTeam(){ System.out.println("\n--------------------团队成员列表---------------------\n"); Programmer[] team = teamService.getTeam(); if(team.length == 0){ System.out.println("开发团队目前没有成员!"); }else{ System.out.println("TID/ID\t姓名\t\t年龄\t\t工资\t\t职位\t\t奖金\t\t股票"); } for(Programmer p : team){ System.out.println(" " + p.getDetailsForTeam()); } System.out.println("-----------------------------------------------------"); } /** * 实现添加成员的操作 */ public void addMenber() { System.out.println("---------------------添加成员---------------------"); System.out.print("请输入要添加的员工ID: "); int id = TSUtility.readInt(); try { Employee e = lIstService.getEmployee(id); teamService.addMenber(e); System.out.println("添加成功"); } catch (TeamException e) { System.out.println("添加失败,原因:" + e.getMessage()); } // 按回车键继续 TSUtility.readReturn(); } /** * 实现删除成员操作 */ public void deleMember(){ System.out.println("---------------------删除成员---------------------"); System.out.print("请输入要删除员工的TID:"); int id = TSUtility.readInt(); System.out.println("确认是否删除(Y/N):"); char yn = TSUtility.readConfirmSelection(); if(yn =='N'){ return; } try { teamService.removeMember(id); System.out.println("删除成功"); } catch (TeamException e) { System.out.println("删除失败,原因:" + e.getMessage()); } //按回车键继续 TSUtility.readReturn(); } public static void main(String[] args){ TeaView teaView = new TeaView(); teaView.enterMainMenu(); }}提取码:kp6t 下载源码