• 一、系统功能结构
  • 二、系统流程
  • 三、实现
    • 以下功能不分先后
    • 3.1账户
      • 3.1.1账户类
      • 3.1.2账户管理类
    • 3.2开发人员
      • 3.2.1架构师类
      • 3.2.2开发人员管理类
      • 3.2.3无职务类
      • 3.2.4程序员类
      • 3.2.5设计师类
    • 3.3开发团队
      • 3.3.1开发团队管理类
    • 3.3测试
      • 3.3.1测试主类
      • 3.3.2测试总菜单
    • 3.4异常
    • 3.5项目
      • 3.5.1项目类
      • 3.5.2项目管理类
    • 3.6工具
      • 3.6.1输入工具
    • 3.6.2其他工具
      • 3.6.3是否工具
  • 四、小结

一、系统功能结构

二、系统流程

三、实现

以下功能不分先后

3.1账户

3.1.1账户类

记录账户属性

package xuexi.java.guanka12Restart.AccountTest;//账户类
public class Account{private String name;//账户名称private String password;//登录密码//有参无参get/setpublic Account() {}public Account(String name, String password) {this.name = name;this.password = password;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}
}

3.1.2账户管理类

关于一些账户的功能在里面

package xuexi.java.guanka12Restart.AccountTest;import xuexi.java.guanka12Restart.ToolTest.ImportTest;import java.util.ArrayList;public class AccountManagement {//注册public void login(ArrayList<Account> user){System.out.println("开始注册:");System.out.println("请输入你的账户名称:");String name=ImportTest.importStringTest();System.out.println("请输入你的登录密码:");String password=ImportTest.importStringTest();;Account a=new Account();a.setName(name);a.setPassword(password);user.add(a);System.out.println("注册成功");}//修改用户名public void peopleNameChange(ArrayList<Account> user){System.out.println("请输入新的用户名");String s=ImportTest.importStringTest();Account a=new Account();a.setName(s);a.setPassword(user.get(0).getPassword());user.set(0,a);System.out.println("修改成功");}//修改密码名public void peoplePasswordChange(ArrayList<Account> user){System.out.println("请输入新的密码");String s=ImportTest.importStringTest();Account a=new Account();a.setPassword(s);a.setName(user.get(0).getName());user.set(0,a);System.out.println("修改成功");}//修改用户名和密码名public void peopleNameChangeAndPassword(ArrayList<Account> user){System.out.println("请输入新的用户名");String s=ImportTest.importStringTest();System.out.println("请输入新的密码");String s1=ImportTest.importStringTest();Account a=new Account(s,s1);user.set(0,a);System.out.println("修改成功");}}

3.2开发人员

3.2.1架构师类

架构师属性

package xuexi.java.guanka12Restart.Developer;//架构师 继承设计师
public class Architect extends Stylist {private int stock;//股票public Architect(int count, String name, int age, double money, String post, boolean exist, String machine, double bonus, int stock) {super(count, name, age, money, post, exist, machine, bonus);this.stock = stock;}public Architect() {setPost("架构师");}public int getStock() {return stock;}public void setStock(int stock) {this.stock = stock;}//重写toString方法@Overridepublic String toString() {return traverse()+"\t"+getPost()+"\t"+isExist()+"\t"+getBonus()+"\t"+stock+"\t"+getMachine();}public int isWho(){return 4;}
}

3.2.2开发人员管理类

关于开发人员的增删改查等功能

package xuexi.java.guanka12Restart.Developer;import xuexi.java.guanka12Restart.ToolTest.ImportTest;
import xuexi.java.guanka12Restart.ToolTest.TrueOfFalseTest;import java.util.ArrayList;
import java.util.Scanner;public class DeveloperManagement {//开发人员管理菜单public void developerTotalMenu(ArrayList<NoPosition> people){while (true){developrSee(people);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("请选择:");Scanner sc=new Scanner(System.in);String s=sc.nextLine();switch (s){case "1":developrAdd(people);break;case "2":developrSee(people);break;case "3":developrChange(people);break;case "4":developrDelete(people);break;case "5":return;default:System.out.println("输入错误,请重新输入");break;}}}//添加员工菜单public void developrAdd(ArrayList<NoPosition> people){System.out.println("请输入需要添加的雇员的职位:");System.out.println("1(无职位)");System.out.println("2(程序员)");System.out.println("3(设计师)");System.out.println("4(架构师)");String s= ImportTest.importStringTest();switch (s){case "1":PeopletAdd(people);break;case "2":programmerAdd(people);break;case "3":stylistAdd(people);break;case "4":architectAdd(people);break;default:System.out.println("输入错误,请重新输入");break;}}//增加无职位public void PeopletAdd(ArrayList<NoPosition> people){System.out.println("请输入当前雇员的姓名:");String s1=ImportTest.importStringTest();System.out.println("请输入当前雇员的年龄:");int s2=ImportTest.importIntTest();System.out.println("请输入当前雇员的工资:");double s3=ImportTest.importDoubleTest();NoPosition developer=new NoPosition();developer.setCount(people.size()+1);developer.setName(s1);developer.setAge(s2);developer.setMoney(s3);people.add(developer);
//        System.out.println("--------------------");
//        System.out.println(people.get(people.size()-1).getAge()
//                   +"\t\t"+people.get(people.size()-1).getPost()
//                   +"\t\t"+people.get(people.size()-1).isExist());
//        System.out.println("--------------------");System.out.println("人员添加成功!");}//增加程序员public void programmerAdd(ArrayList<NoPosition> people){System.out.println("请输入当前雇员的姓名:");String s1=ImportTest.importStringTest();System.out.println("请输入当前雇员的年龄:");int s2=ImportTest.importIntTest();System.out.println("请输入当前雇员的工资:");double s3=ImportTest.importDoubleTest();System.out.println("请为当前程序员配一台好的台式电脑:");System.out.println("请输入需要配置的台式电脑型号:" );String s4=ImportTest.importStringTest();System.out.println("请输入需要配置的台式电脑的显示器名称:");String s5=ImportTest.importStringTest();String s6=s4+"("+s5+")";NoPosition developer=new Programmer();Programmer programmer=(Programmer)developer;programmer.setCount(people.size()+1);programmer.setName(s1);programmer.setAge(s2);programmer.setMoney(s3);programmer.setMachine(s6);people.add(developer);System.out.println("设备添加成功!");System.out.println("人员添加成功!");}//增加设计师public void stylistAdd(ArrayList<NoPosition> people){System.out.println("请输入当前雇员的姓名:");String s1=ImportTest.importStringTest();System.out.println("请输入当前雇员的年龄:");int s2=ImportTest.importIntTest();System.out.println("请输入当前雇员的工资:");double s3=ImportTest.importDoubleTest();System.out.println("请输入当前雇员的奖金");double ss1=ImportTest.importDoubleTest();
//        System.out.println("请输入当前雇员的股票");
//        int ss2=sc.nextInt();System.out.println("请为当前程序员配一台好的台式电脑:");System.out.println("请输入需要配置的台式电脑型号:" );String s4=ImportTest.importStringTest();System.out.println("请输入需要配置的台式电脑的显示器名称:");String s5=ImportTest.importStringTest();String s6=s4+"("+s5+")";NoPosition developer=new Stylist();Stylist stylist=(Stylist)developer;stylist.setCount(people.size()+1);stylist.setName(s1);stylist.setAge(s2);stylist.setMoney(s3);stylist.setBonus(ss1);stylist.setMachine(s6);people.add(stylist);System.out.println("设备添加成功!");System.out.println("人员添加成功!");}//增加架构师public void architectAdd(ArrayList<NoPosition> people){System.out.println("请输入当前雇员的姓名:");String s1=ImportTest.importStringTest();System.out.println("请输入当前雇员的年龄:");int s2=ImportTest.importIntTest();System.out.println("请输入当前雇员的工资:");double s3=ImportTest.importDoubleTest();System.out.println("请输入当前雇员的奖金");double ss1=ImportTest.importDoubleTest();System.out.println("请输入当前雇员的股票");int ss2=ImportTest.importIntTest();System.out.println("请为当前程序员配一台好的台式电脑:");System.out.println("请输入需要配置的台式电脑型号:" );String s4=ImportTest.importStringTest();System.out.println("请输入需要配置的台式电脑的显示器名称:");String s5=ImportTest.importStringTest();String s6=s4+"("+s5+")";NoPosition developer=new Architect();Architect architect=(Architect)developer;architect.setCount(people.size()+1);architect.setName(s1);architect.setAge(s2);architect.setMoney(s3);architect.setBonus(ss1);architect.setStock(ss2);architect.setMachine(s6);people.add(architect);System.out.println("设备添加成功!");System.out.println("人员添加成功!");}//查看public void developrSee(ArrayList<NoPosition> people){System.out.println("ID\t 姓名\t年龄\t 工资\t 职位\t 状态\t 奖金\t 股票\t 领用设备");for(int a=0;a<people.size();a++){see(people,a);}}//查看方法public void see(ArrayList<NoPosition> people,int a){NoPosition d=people.get(a);if(d.isWho()==1){System.out.println(d.toString());}if(d.isWho()==2){Programmer c=(Programmer)d;System.out.println(c);}if(d.isWho()==3){Stylist c=(Stylist) d;System.out.println(c);}if(d.isWho()==4){Architect c=(Architect)d;System.out.println(c);}}//改public void developrChange(ArrayList<NoPosition> people){System.out.println("请输入需要修改的员工id");int a=ImportTest.importIntTest();NoPosition d=people.get(a-1);//判断修改的员工的职位是什么
//        if(d instanceof Architect){//            Architect c=(Architect)d;
//        }else if(d instanceof Stylist){//            Stylist c=(Stylist) d;
//        }else if(d instanceof Programmer){//            Programmer c=(Programmer)d;
//        }else if(d instanceof NoPosition){//            NoPosition c=(NoPosition)d;
//        }System.out.println("姓名("+d.getName()+")");String name=ImportTest.importStringTestNull();System.out.println("年龄("+d.getAge()+")");int age=ImportTest.importIntTestNull();System.out.println("工资("+d.getMoney()+")");double money=ImportTest.importDoubleTestNull();if(name.equals("")){}else{d.setName(name);}if(age==-1){}else {d.setAge(age);}if(money==-1){}else {d.setMoney(money);}people.set(a-1,d);System.out.println("修改成功!");}//删public void developrDelete(ArrayList<NoPosition> people){System.out.println("请输入你要删除的员工的ID");int a= TrueOfFalseTest.isPeopleTeam(people);System.out.println("确定要删除此员工(Y/N):");if(!TrueOfFalseTest.yOrN()){return;}people.remove(a-1);ImportTest.idChange(a,people);System.out.println("删除成功");}
}

3.2.3无职务类

无职务人员属性

package xuexi.java.guanka12Restart.Developer;//无职位
public class NoPosition {private int count;//IDprivate String name;//姓名private int age;//年龄private double money;//工资//有参无参get/setpublic NoPosition() {}public NoPosition(int count, String name, int age, double money) {this.count = count;this.name = name;this.age = age;this.money = money;}public int getCount() {return count;}public void setCount(int count) {this.count = count;}public String getName() {return name;}public void setName(String name) {this.name = name;}public int getAge() {return age;}public void setAge(int age) {this.age = age;}public double getMoney() {return money;}public void setMoney(double money) {this.money = money;}//返回信息public String traverse(){String s= count +"\t"+name+" \t"+age+"\t"+money;return s;}//重写toString方法@Overridepublic String toString() {return traverse();}public int isWho(){return 1;}
}

3.2.4程序员类

程序员属性

package xuexi.java.guanka12Restart.Developer;//程序员 继承无职业
public class Programmer extends NoPosition {private String post;//职位private boolean exist;//状态private String machine;//领用设备//初始化职位和状态public Programmer() {post="程序员";exist=true;}public Programmer(int count, String name, int age, double money, String post, boolean exist, String machine) {super(count, name, age, money);this.post = post;this.exist = exist;this.machine = machine;}//get/setpublic String getPost() {return post;}public void setPost(String post) {this.post = post;}public boolean isExist() {return exist;}public void setExist(boolean exist) {this.exist = exist;}public String getMachine() {return machine;}public void setMachine(String machine) {this.machine = machine;}//重写toString方法@Overridepublic String toString() {return traverse()+"\t"+post+"\t"+exist+"\t\t\t\t\t"+machine;}public int isWho(){return 2;}
}

3.2.5设计师类

设计师属性

package xuexi.java.guanka12Restart.Developer;//设计师 继承程序员
public class Stylist extends Programmer {private double bonus;//奖金public Stylist() {setPost("设计师");}public Stylist(int count, String name, int age, double money, String post, boolean exist, String machine, double bonus) {super(count, name, age, money, post, exist, machine);this.bonus = bonus;}public double getBonus() {return bonus;}public void setBonus(double bonus) {this.bonus = bonus;}//重写toString@Overridepublic String toString() {return traverse()+"\t"+getPost()+"\t"+isExist()+"\t"+bonus+"\t\t\t"+getMachine();}public int isWho(){return 3;}
}

3.3开发团队

3.3.1开发团队管理类

关于开发团队的一些功能,增加团队,增加团队人员等

package xuexi.java.guanka12Restart.DevelopmentTeam;import xuexi.java.guanka12Restart.Developer.DeveloperManagement;
import xuexi.java.guanka12Restart.Developer.NoPosition;
import xuexi.java.guanka12Restart.ExceptionTest.PeopleOverflowException;
import xuexi.java.guanka12Restart.ToolTest.ImportTest;
import xuexi.java.guanka12Restart.ToolTest.OtherToolTest;
import xuexi.java.guanka12Restart.ToolTest.TrueOfFalseTest;import java.util.ArrayList;
import java.util.Scanner;public class DevelopmentTeamManagement {//开发团队管理菜单DeveloperManagement developerManagement=new DeveloperManagement();public void teamMenu(ArrayList<NoPosition> people, ArrayList<ArrayList<NoPosition>> team){while(true){System.out.println("团队调度界面");System.out.println("1-添加团队 2-查看团队 3-删除团队 4-退出 请选择(1-4):");Scanner sc=new Scanner(System.in);String s=sc.nextLine();switch (s){case "1"://添加teamAddMenu(people,team);break;case "2"://查看teamSee(team);break;case "3"://删除teamDelete(team);break;case "4":return;default:System.out.println("输入错误,请重新输入");break;}}}//添加团队菜单public void teamAddMenu(ArrayList<NoPosition> people,ArrayList<ArrayList<NoPosition>> team){ArrayList<NoPosition> arrayList=new ArrayList<>();while(true){System.out.println("1-团队列表 2-添加团队成员 3-删除团队成员 4-退出 请选择(1-4):");String s= ImportTest.importStringTest();switch (s){case "1":teamList(arrayList);break;//团队列表case "2":if(TrueOfFalseTest.isAllFalse(people)){System.out.println("所有开发人员已被分配,请添加新的员工");break;}addTeamPeople(people,arrayList);//添加团队成员break;case "3":deleteTeamPeople(arrayList,people);break;//删除团队成员case "4":if(arrayList.size()==0){return;}else{team.add(arrayList);return;}default:System.out.println("输入有误,请重新输入");break;}}}//团队成员列表public void teamList(ArrayList<NoPosition> arrayList){System.out.println("--------------团队成员列表--------------");System.out.println("TID/ID\t 姓名\t年龄\t 工资\t 职位\t 状态\t 奖金\t 股票\t 领用设备");DeveloperManagement developerManagement=new DeveloperManagement();for(int a=0;a<arrayList.size();a++){System.out.print("  "+(a+1)+"/");developerManagement.see(arrayList,a);}System.out.println("--------------------------------------------");}//添加团队成员//此模块存在可改进地方,只剩一个架构师,但是存在架构师重合情况,添加不了,应设置对比并返回public void addTeamPeople(ArrayList<NoPosition> people,ArrayList<NoPosition> arrayList){try {if(arrayList.size()==5){throw new PeopleOverflowException();}}catch (PeopleOverflowException e){System.out.println(e.toString());return;}developerManagement.developrSee(people);System.out.println("请输入要添加的员工ID");int a=TrueOfFalseTest.isPeopleTeam(people,arrayList);//判断ID员工是否存在以及是否被调用以及是否超出人员限制//判断语句,输错返回if(a==-1){return;}//将队员状态变为falseOtherToolTest.falseChange(people,a);arrayList.add(people.get(a-1));System.out.println("添加成功");}//删除团队成员public void deleteTeamPeople(ArrayList<NoPosition> arrayList,ArrayList<NoPosition> people){if(arrayList.size()==0){System.out.println("还没有团队成员");return;}teamList(arrayList);System.out.println("请输入要删除的成员的TID");int a=TrueOfFalseTest.isPeople(arrayList);System.out.println("确定要删除此成员(Y/N):");if(!TrueOfFalseTest.yOrN()){return;}//将队员状态变为TrueOtherToolTest.trueChange(people,arrayList.get(a-1).getCount());arrayList.remove(a-1);System.out.println("删除成功");}//查看团队public void teamSee(ArrayList<ArrayList<NoPosition>> team){DeveloperManagement developerManagement=new DeveloperManagement();System.out.println("-------------团队列表-----------------");for(int a =0;a<team.size();a++){for(int b=0;b<team.get(a).size();b++){developerManagement.see(team.get(a),b);}System.out.println("-------------------------------------");}}//删除团队//--------待完善----------//团队应该跟项目绑定public void teamDelete(ArrayList<ArrayList<NoPosition>> team){System.out.println("请输入想要删除第几个团队");int a=TrueOfFalseTest.isTeam(team);System.out.println("是否删除这个团队(Y/N):");if(!TrueOfFalseTest.yOrN()){return;}team.remove(a-1);}}

3.3测试

3.3.1测试主类

package xuexi.java.guanka12Restart.EnterTest;public class Test {public static void main(String[] args) throws InterruptedException {while (true){try {new TotalMenu().loginTest();}catch (Exception e){e.printStackTrace();System.out.println("未知异常,请收集信息,联系管理员处理");System.out.println("正在为您重置系统,请稍后");Thread.sleep(3000);}}}
}

3.3.2测试总菜单

package xuexi.java.guanka12Restart.EnterTest;import xuexi.java.guanka12Restart.AccountTest.Account;
import xuexi.java.guanka12Restart.AccountTest.AccountManagement;
import xuexi.java.guanka12Restart.Developer.*;
import xuexi.java.guanka12Restart.DevelopmentTeam.DevelopmentTeamManagement;
import xuexi.java.guanka12Restart.ProjectTest.Project;
import xuexi.java.guanka12Restart.ProjectTest.ProjectManagement;
import xuexi.java.guanka12Restart.ToolTest.ImportTest;import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;public class TotalMenu {ArrayList<Account> user = new ArrayList<>();AccountManagement accountManagement=new AccountManagement();DeveloperManagement developerManagement=new DeveloperManagement();DevelopmentTeamManagement developmentTeamManagement=new DevelopmentTeamManagement();ProjectManagement projectManagement=new ProjectManagement();//开始登录public void loginTest(){System.out.println("欢迎来到项目开发团队分配管理软件");System.out.println("请您先登录");register();}//登录public void register() {int count=0;ArrayList<NoPosition> people=new ArrayList<>();ArrayList<ArrayList<NoPosition>> team=new ArrayList<>();NoPosition d1=new NoPosition(1,"马云",22,3000);NoPosition d2=new Architect(2,"马化腾",32,18000,"架构师",true,"联想T4",60000,5000);NoPosition d3=new Programmer(3,"李彦宏",23,7000,"程序员",true,"戴尔");NoPosition d4=new Programmer(4,"刘强东",24,7300,"程序员",true,"戴尔");NoPosition d5=new Stylist(5,"雷军",50,10000,"设计师",true,"激光",5000);NoPosition d6=new Programmer(6,"任志强",30,16800,"程序员",true,"华硕");NoPosition d7=new Stylist(7,"柳传志",45,35500,"设计师",true,"华硕",8000);NoPosition d8=new Architect(8,"杨元庆",35,6500,"架构师",true,"针式",15500,1200);NoPosition d9=new Stylist(9,"史玉柱",27,7800,"设计师",true,"惠普",1500);NoPosition d10=new Programmer(10,"丁磊",26,6600,"程序员",true,"戴尔");NoPosition d11=new Programmer(11,"张朝阳",35,7100,"程序员",true,"华硕");NoPosition d12=new Stylist(12,"杨致远",38,9600,"设计师",true,"惠普m6",3000);Collections.addAll(people,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12);ArrayList<Project> project=new ArrayList<>();while (true){System.out.println("登录界面");System.out.println("请输入你的账户名称:");String name = ImportTest.importStringTest();System.out.println("请输入你的登录密码:");String password = ImportTest.importStringTest();if (user.size() == 0) {System.out.println("未检测到您的账号,请您先注册");accountManagement.login(user);}else{for(int a=0;a<user.size();a++){Account s=user.get(a);if(s.getName().equals(name)&&s.getPassword().equals(password)){System.out.println("登录成功!欢迎您:"+name);count=0;totalMenu(user,people,team,project);}else {count++;if(count==5){System.out.println("你用完了所有的机会,再见");System.exit(0);}System.out.println("登录失败!用户名或密码不匹配!");System.out.println("登录次数还剩"+(5-count)+"次,请重新输入");}}}}}//主菜单public void totalMenu(ArrayList<Account> user,ArrayList<NoPosition> people,ArrayList<ArrayList<NoPosition>> team,ArrayList<Project> project){while (true){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("请选择:");String s=ImportTest.importStringTest();switch (s){case "1":if(messageChangeMenu(user)){return;}break;case "2":developerManagement.developerTotalMenu(people);break;case "3":developmentTeamManagement.teamMenu(people,team);break;case "4":projectManagement.projectMenu(project,team);break;case "5":System.exit(0);break;default:System.out.println("输入错误,请重新输入:");break;}}}//用户信息修改菜单public boolean messageChangeMenu(ArrayList<Account> user){while (true){System.out.println("修改界面");System.out.println("请输入你需要修改的类型:");System.out.println("1(修改用户名)");System.out.println("2(修改密码名)");System.out.println("3(修改用户名和密码名)");System.out.println("4(不修改,退出)");Scanner sc=new Scanner(System.in);String s=sc.nextLine();switch (s){case "1":accountManagement.peopleNameChange(user);System.out.println("用户信息发送改变,请重新登录");return true;case "2":accountManagement.peoplePasswordChange(user);System.out.println("用户信息发送改变,请重新登录");return true;case "3":accountManagement.peopleNameChangeAndPassword(user);System.out.println("用户信息发送改变,请重新登录");return true;case "4":return false;default:System.out.println("输入错误,请重新输入");break;}}}
}

3.4异常

该成员已是某团队成员异常

package xuexi.java.guanka12Restart.ExceptionTest;//该成员已是某团队成员
public class AlreadyExistThatException extends Exception{public AlreadyExistThatException() {super("该成员已是某团队成员");}public AlreadyExistThatException(String message) {super(message);}
}

该人员已在本开发团队中异常

package xuexi.java.guanka12Restart.ExceptionTest;//该人员已在本开发团队中
public class AlreadyExistThisException extends Exception {public AlreadyExistThisException() {super("该人员已在本开发团队中");}public AlreadyExistThisException(String message) {super(message);}
}

不是开发人员异常

package xuexi.java.guanka12Restart.ExceptionTest;//不是开发人员
public class NoDeveloprException extends Exception {public NoDeveloprException() {super("此人员不是开发人员");}public NoDeveloprException(String message) {super(message);}
}

一个架构师异常

package xuexi.java.guanka12Restart.ExceptionTest;//一个架构师
public class OneArchitectException extends Exception {public OneArchitectException() {super("团队中至多只能有一名架构师");}public OneArchitectException(String message) {super(message);}
}

成员已满,无法添加异常

package xuexi.java.guanka12Restart.ExceptionTest;//成员已满,无法添加
public class PeopleOverflowException extends Exception {public PeopleOverflowException() {super("团队成员已满");}public PeopleOverflowException(String message) {super(message);}
}

三个程序员异常

package xuexi.java.guanka12Restart.ExceptionTest;//三个程序员
public class ThreeProgrammerException extends Exception {public ThreeProgrammerException() {super("团队中至多只能有三名程序员");}public ThreeProgrammerException(String message) {super(message);}
}

两个设计师异常

package xuexi.java.guanka12Restart.ExceptionTest;//两个设计师
public class TwoStyListException extends Exception {public TwoStyListException() {super("团队中至多只能有两名设计师");}public TwoStyListException(String message) {super(message);}
}

3.5项目

3.5.1项目类

项目的属性

package xuexi.java.guanka12Restart.ProjectTest;public class Project {private String projectName;//项目名private String projectDescribe;//项目描述private String projectTeam;//分配的团队private boolean projectState;//项目状态private int teamId;//分配的团队下标//有参无参get/set方法public Project() {projectTeam=null;projectState=false;teamId=-1;}public Project(String projectName, String projectDescribe) {this.projectName = projectName;this.projectDescribe = projectDescribe;//因为模块中new的是这个,没用用到无参,所以在这里加上默认值projectTeam=null;projectState=false;teamId=-1;}public Project(String projectName, String projectDescribe, String projectTeam, boolean projectState) {this.projectName = projectName;this.projectDescribe = projectDescribe;this.projectTeam = projectTeam;this.projectState = projectState;}public String getProjectName() {return projectName;}public void setProjectName(String projectName) {this.projectName = projectName;}public String getProjectDescribe() {return projectDescribe;}public void setProjectDescribe(String projectDescribe) {this.projectDescribe = projectDescribe;}public String getProjectTeam() {return projectTeam;}public void setProjectTeam(String projectTeam) {this.projectTeam = projectTeam;}public boolean isProjectState() {return projectState;}public int getTeamId() {return teamId;}public void setTeamId(int teamId) {this.teamId = teamId;}public void setProjectState(boolean projectState) {this.projectState = projectState;}//重写toString方法@Overridepublic String toString() {return "项目名=‘"+getProjectName()+"’,项目描述=‘"+getProjectDescribe()+"’,开发团队名称=‘"+getProjectTeam()+"’,开发状态="+isProjectState()+"}"+"\n" +"项目【"+getProjectName()+"】---->未被开发!";}//展示项目public void shouProject(int a){System.out.println((a+1)+"."+getProjectName()+":"+getProjectDescribe());}
}

3.5.2项目管理类

关于添加项目、删除项目等方法

package xuexi.java.guanka12Restart.ProjectTest;import xuexi.java.guanka12Restart.Developer.DeveloperManagement;
import xuexi.java.guanka12Restart.Developer.NoPosition;
import xuexi.java.guanka12Restart.ToolTest.ImportTest;
import xuexi.java.guanka12Restart.ToolTest.OtherToolTest;
import xuexi.java.guanka12Restart.ToolTest.TrueOfFalseTest;import java.util.ArrayList;
import java.util.Random;
import java.util.Scanner;public class ProjectManagement {public void projectMenu(ArrayList<Project> project,ArrayList<ArrayList<NoPosition>> team){while (true){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("请选择:");Scanner sc=new Scanner(System.in);String s=sc.nextLine();switch (s){case "1":projectAdd(project,team);break;case "2":int x=OtherToolTest.alreadyProject(project);projectDistribution(project,team,x);break;case "3":projectSee(project);break;case "4":projectDelete(project);break;case "5":return;default:System.out.println("输入错误,请重新输入");break;}}}//添加项目public void projectAdd(ArrayList<Project> project,ArrayList<ArrayList<NoPosition>> team){if(team.size()==0){System.out.println("当前无任何团队能做新项目,请去分配团队");return;}String s1="1.小米官网:开发完成类似于小米官网的web项目";String s2="2.公益在线商城:猫宁Morning公益商城是中国公益性在线电子商城";String s3="3.博客系统:java博客商城,让每一个有故事的人更好的表达想法!";String s4="4.在线协作文档编辑结构:一个很常用的功能,适合小组内的文档编辑";System.out.println("项目参考:------------------------------");System.out.println(s1);System.out.println(s2);System.out.println(s3);System.out.println(s4);System.out.println("--------------------------------------");System.out.println("请输入你想添加的项目:");Scanner sc=new Scanner(System.in);while (true){String a=sc.nextLine();switch (a){case "1":Project p1=new Project("小米官网","开发完成类似于小米官网的web项目");project.add(p1);System.out.println("已添加项目:小米官网");return;case "2":Project p2=new Project("公益在线商城","猫宁Morning公益商城是中国公益性在线电子商城");project.add(p2);System.out.println("已添加项目:公益在线商城");return;case "3":Project p3=new Project("博客系统","java博客商城,让每一个有故事的人更好的表达想法!");project.add(p3);System.out.println("已添加项目:博客系统");return;case "4":Project p4=new Project("在线协作文档编辑结构","一个很常用的功能,适合小组内的文档编辑");project.add(p4);System.out.println("已添加项目:在线协作文档编辑结构");return;default:System.out.print("选择错误,请重新输入:");break;}}}//分配项目public void projectDistribution(ArrayList<Project> project,ArrayList<ArrayList<NoPosition>> team,int x){DeveloperManagement developerManagement=new DeveloperManagement();Random r=new Random();int n= OtherToolTest.idleCondion(project,team);//没被分配的项目,没被随机的团队,取最小值if(n==0){System.out.println("还没空余的项目或团队哦");}
//        int[] c=new int[n];//这里是想分配后的团队记录下来,判断是否重复,但是下一次分配会清零,删除for(int a =0;a<n;a++){int seed= TrueOfFalseTest.noSameNumber(project,team);//随机团队下标System.out.println("当前团队有人员:");for(int b=0;b<team.get(seed).size();b++){developerManagement.see(team.get(seed),b);}System.out.println("请为当前团队创建一个团队名称:");String s= ImportTest.importStringTest();Project j=project.get(a+x);//赋值团队名称以及团队下标j.setProjectTeam(s);j.setTeamId(seed);//添加项目已被使用状态j.setProjectState(true);//更新项目属性project.set(a+x,j);}}//查看项目public void projectSee(ArrayList<Project> project){for(int a=0;a<project.size();a++){if(project.get(a).isProjectState()){System.out.println("项目【"+project.get(a).getProjectName()+"】---->正在被团队【"+project.get(a).getProjectTeam()+"】开发中!");}else{System.out.print("项目{项目号='"+(a+1)+"'");System.out.println(project.get(a).toString());}}}//删除项目public void projectDelete(ArrayList<Project> project){//判断项目是否都在运行if(TrueOfFalseTest.isAllProjectTure(project)){System.out.println("没有空闲的项目可以删除");return;}projectSee(project);System.out.println("请输入你想删除项目的项目号:");int a=TrueOfFalseTest.isProject(project);System.out.println("确定要删除此项目吗(Y/N):");if(!TrueOfFalseTest.yOrN()){return;}project.remove(a-1);}}

3.6工具

3.6.1输入工具

关于输入的一些方法,比如输入整数,输入浮点数,输入空等

package xuexi.java.guanka12Restart.ToolTest;import xuexi.java.guanka12Restart.Developer.NoPosition;import java.util.ArrayList;
import java.util.Scanner;public class ImportTest {//输入字符串public static String importStringTest(){Scanner sc=new Scanner(System.in);while (true){String s=sc.nextLine();if(s.length()==0){System.out.println("输入不能为空,请重新输入");continue;}return s;}}//输入整数public static int importIntTest(){while (true){Scanner sc=new Scanner(System.in);try {int a=sc.nextInt();if(isNagative(a)){continue;}return a;}catch (Exception e){System.out.println("输入错误,请重新输入");}}}//输入浮点数public static double importDoubleTest(){while (true){Scanner sc=new Scanner(System.in);try {double a=sc.nextDouble();if(isNagative(a)){continue;}return a;}catch (Exception e){System.out.println("输入错误,请重新输入");}}}//输入字符串可空public static String importStringTestNull(){Scanner sc=new Scanner(System.in);String s=sc.nextLine();return s;}//输入整数可空public static int importIntTestNull(){while (true){Scanner sc=new Scanner(System.in);try {String s=sc.nextLine();if(s.equals("")){return -1;}int a=Integer.parseInt(s);return a;}catch (Exception e){System.out.println("输入错误,请重新输入");}}}//输入浮点数可空public static double importDoubleTestNull(){while (true){Scanner sc=new Scanner(System.in);try {String s=sc.nextLine();if(s.equals("")){return -1;}double a=Double.parseDouble(s);return a;}catch (Exception e){System.out.println("输入错误,请重新输入");}}}//判断负数public static boolean isNagative(int a){if(a<0){System.out.println("输入不能为负,请重新输入");return true;}return false;}public static boolean isNagative(double a){if(a<0){System.out.println("输入不能为负,请重新输入");return true;}return false;}//ID顺位public static void idChange(int a,ArrayList<NoPosition> people){for(int x=a-1;x<people.size();x++){NoPosition noPosition=people.get(x);noPosition.setCount(x+1);people.set(x,noPosition);}}
}

3.6.2其他工具

其他的一些工具

package xuexi.java.guanka12Restart.ToolTest;import xuexi.java.guanka12Restart.Developer.NoPosition;
import xuexi.java.guanka12Restart.Developer.Programmer;
import xuexi.java.guanka12Restart.ProjectTest.Project;import java.util.ArrayList;public class OtherToolTest {//将员工状态变为falsepublic static void falseChange(ArrayList<NoPosition> people,int a){NoPosition c=people.get(a-1);((Programmer)c).setExist(false);people.set(a-1,c);}//将员工状态变为Truepublic static void trueChange(ArrayList<NoPosition> people,int a){NoPosition c=people.get(a-1);((Programmer)c).setExist(true);people.set(a-1,c);}//空闲状态的项目和团队public static int idleCondion(ArrayList<Project> project, ArrayList<ArrayList<NoPosition>> team){int a=0,b=0;//空闲项目个数for(int x=0;x<project.size();x++){if(!project.get(x).isProjectState()){a++;}}//空闲团队个数b=team.size()-(project.size()-a);return a<b?a:b;}//已经开发的团队个数public static int alreadyProject(ArrayList<Project> project){int i=0;for(int a=0;a<project.size();a++){if(project.get(a).isProjectState()){i++;}}return i;}
}

3.6.3是否工具

判断是否的工具,比如是否存在,是否处于什么阶段等

package xuexi.java.guanka12Restart.ToolTest;import xuexi.java.guanka12Restart.Developer.Architect;
import xuexi.java.guanka12Restart.Developer.NoPosition;
import xuexi.java.guanka12Restart.Developer.Programmer;
import xuexi.java.guanka12Restart.Developer.Stylist;
import xuexi.java.guanka12Restart.ExceptionTest.*;
import xuexi.java.guanka12Restart.ProjectTest.Project;import java.util.ArrayList;
import java.util.Random;public class TrueOfFalseTest {//判断账号是否存在public void isAccountExist(){}//判断ID员工是否存在(成员情况)public static int isPeople(ArrayList<NoPosition> people){while (true){int a=ImportTest.importIntTest();if(1>a||a>people.size()){System.out.println("员工不存在,请重新输入");continue;}return a;}}//判断ID员工是否存在(团队占用情况)public static int isPeopleTeam(ArrayList<NoPosition> people){while (true){int a=ImportTest.importIntTest();if(1>a||a>people.size()){System.out.println("员工不存在,请重新输入");continue;}if(!((Programmer)(people.get(a))).isExist()){System.out.println("该员工正在团队中,无法删除");System.out.println("如要删除,请现在团队中删除该员工");System.out.println("请重新输入");continue;}return a;}}//Y/Npublic static boolean yOrN(){while (true){String s=ImportTest.importStringTestNull();if(s.equals("Y")||s.equals("y")){return true;}else if(s.equals("N")||s.equals("n")){return false;}else {System.out.println("输入有误,请重新输入");}}}//判断ID员工是否存在以及是否被调用以及是否超出人员限制public static int isPeopleTeam(ArrayList<NoPosition> people,ArrayList<NoPosition> arrayList) {int o=0;while (true) {o++;if(o==4){System.out.println("连续错误3次,正在返回中...");return -1;}try {int a = ImportTest.importIntTest();if (1 > a || a > people.size()) {System.out.println("员工不存在,请重新输入");continue;}NoPosition noPosition = people.get(a-1);//判断是否开发人员if (noPosition instanceof Architect) {//                    System.out.println("测试1");} else if (noPosition instanceof Stylist) {//                    System.out.println("测试2");} else if (noPosition instanceof Programmer) {//                    System.out.println("测试3");} else {throw new NoDeveloprException();}//判断是否已在本团队中thisTeam(arrayList,a);//判断是否在其他团队中if (!((Programmer)noPosition).isExist()) {throw new AlreadyExistThatException();}//判断人员分配是否合理if (noPosition instanceof Architect) {allArchitect(arrayList);} else if (noPosition instanceof Stylist) {allStylist(arrayList);} else if (noPosition instanceof Programmer) {allProgrammer(arrayList);}return a;}catch (NoDeveloprException e){System.out.println(e.toString());System.out.println("请重新输入");}catch (AlreadyExistThisException e){System.out.println(e.toString());System.out.println("请重新输入");}catch (AlreadyExistThatException e){System.out.println(e.toString());System.out.println("请重新输入");}catch (OneArchitectException e){System.out.println(e.toString());System.out.println("请重新输入");}catch (TwoStyListException e){System.out.println(e.toString());System.out.println("请重新输入");}catch (ThreeProgrammerException e){System.out.println(e.toString());System.out.println("请重新输入");} catch (Exception e){e.printStackTrace();System.out.println("未知异常,请收集信息并联系管理员处理");System.out.println("请重新输入");}}}//判断团队成员是否超出配置public static boolean isPeopleTeamFull(ArrayList<NoPosition> arrayList){return false;}//是否本团队public static void thisTeam(ArrayList<NoPosition> arrayList,int a) throws AlreadyExistThisException {for(int x=0;x<arrayList.size();x++){if(arrayList.get(x).getCount()==a){throw new AlreadyExistThisException();}}}//架构师是否溢出public static void allArchitect(ArrayList<NoPosition> arrayList) throws OneArchitectException {int a=0;for(int x=0;x<arrayList.size();x++){if (arrayList.get(x) instanceof Architect) {a++;}}if(a==1){throw new OneArchitectException();}}//设计师是否溢出public static void allStylist(ArrayList<NoPosition> arrayList) throws TwoStyListException {int a=0;for(int x=0;x<arrayList.size();x++){if(arrayList.get(x) instanceof Architect){}else if (arrayList.get(x) instanceof Stylist) {a++;}}if(a==2){throw new TwoStyListException();}}//程序员是否溢出public static void allProgrammer(ArrayList<NoPosition> arrayList) throws ThreeProgrammerException {int a=0;for(int x=0;x<arrayList.size();x++){if(arrayList.get(x) instanceof Architect){}else if(arrayList.get(x) instanceof Stylist){}else if (arrayList.get(x) instanceof Programmer) {a++;}}if(a==3){throw new ThreeProgrammerException();}}//判断ID团队是否存在public static int isTeam(ArrayList<ArrayList<NoPosition>> team){while (true){int a=ImportTest.importIntTest();if(1>a||a>team.size()){System.out.println("团队不存在,请重新输入");continue;}return a;}}//项目随机分配团队,随机不重复//团队没有记录状态,所以项目增加一个属性用于记录团队的下标public static int noSameNumber(ArrayList<Project> project,ArrayList<ArrayList<NoPosition>> team){Random r=new Random();int a=0;o:while (true){a=r.nextInt(team.size());for(int x=0;x<project.size();x++){if(a==project.get(x).getTeamId()){continue o;}}break ;}return a;}//判断ID项目是否存在public static int isProject(ArrayList<Project> project){while (true){int a=ImportTest.importIntTest();if(1>a||a>project.size()){System.out.println("项目不存在,请重新输入");continue;}//正在开发的项目,设置无法删除if(project.get(a-1).isProjectState()){System.out.println("该项目正在开发,无法删除,请重新输入");continue;}return a;}}//判断是否所有的技术人员都在团队中public static boolean isAllFalse(ArrayList<NoPosition> people){for(int a=0;a<people.size();a++){NoPosition c=people.get(a);if(c instanceof Programmer){if(((Programmer) c).isExist()){return false;}}}return true;}//判断项目是否都处于开发阶段public static boolean isAllProjectTure(ArrayList<Project> project){for(int a=0;a<project.size();a++){if(project.get(a).isProjectState()==false){return false;}}return true;}
}

四、小结

这算是做得时间比较长的项目了,是对之前的知识的总结,巩固了之前的知识,但是还是发现接口和抽象类没怎么用上,不知道怎么用,感觉又没有什么用。
程序写了两遍,第一遍写思路,就像语文的打草稿,我先按照正常的流程走一遍,bug不管,只要能走一遍,能运行出来。然后第二遍在第一遍的基础上改进,一个模块一个模块的改进,写完一个模块然后优化方法,然后测试,然后修改bug,后面每写一个模块,都与前面一个模块连接起来,然后改bug,优化方法。最后程序是勉强做出来了,但是还是存在问题,问题就不说了,点到为止,嘿嘿嘿

项目 开发团队分配管理软件相关推荐

  1. 项目开发团队分配管理软件总结

    目录 前言 一.项目需求 二.主要思路 三.系统流程 四.代码实现 4.1 登录 4.2 开发人员管理模块 4.3开发团队调度管理模块 4.4开发项目管理模块 4.5 IndexView类的设计 五. ...

  2. Java综合项目----开发团队分配管理软件

    Java综合项目----开发团队分配管理软件 源代码下载地址: 简介 需求说明 系统功能结构 系统流程 用户注册和登录模块 开发人员管理模块 Equipment接口及其实现子类的设计 Employee ...

  3. Java 项目开发团队分配管理软件

    目录 1 系统结构功能 2 系统流程 3 软件设计 3.0 前提 3.1 用户注册登录模块 3.2 开发人员管理模块 在这个模块中,我们需要创建几个实体类 3.3 开发团队调度管理模块 3.3.1 需 ...

  4. 【JAVA】项目开发团队分配管理软件

    目录 前言: 一.系统功能结构 二.系统流程 三.实现思路 四.常见问题 五.具体实现代码 六.全部代码 前言: 模拟实现一个基于文本界面的<项目开发团队分配管理软件> 熟悉Java面向对 ...

  5. 项目开发团队分配管理软件

    一.目标 1.模拟实现一个基于文本界面的<项目开发团队分配管理软件>: 2.熟悉Java面向对象的高级特性,进一步掌握编程技巧和调试技巧. 3.主要涉及以下知识点: 类的继承性和多态性 对 ...

  6. java实现、项目开发团队分配管理软件

    目标: 模拟实现一个基于文本界面的<项目开发团队分配管理软件> 熟悉Java面向对象的高级特性,进一步掌握编程技巧和调试技巧 主要涉及以下知识点: 类的继承性和多态性 对象的值传递.接口 ...

  7. 实现一个项目开发团队分配管理软件思路及过程

    做一个项目之前首先要知道做什么?实现什么功能?得到什么效果?然后再理思绪以及怎么做,慢慢来,一口吃不成个胖子,切忌一上来就动手做,简单的代码还好,一旦代码更多更复杂进行到后面就很容易乱成一锅粥,所以我 ...

  8. 【面向对象应用~.~】——项目开发团队分配管理软件

    项目大纲 项目介绍 [项目前提] [项目说明] [项目结构] [项目需求] [项目设计框架] 系统功能设计 用户登录和注册 开发人员管理 开发团队调度管理 开发项目管理 各系统功能合并 合并过程 注意 ...

  9. 实践项目《项目开发团队分配管理软件》

    引言 学习接触java有一段时间了,过了一关又一关,掌握并且应用了许多知识同时也在遗忘,第一次接触包含各个部分内容的对我来说大型的项目.在写博客总结的时候回顾为这个项目敲下第一个字符的时候,觉得我能坚 ...

最新文章

  1. C语言字符串操作函数
  2. flash 版的mp3编码代码
  3. 手动脱Mole Box壳实战总结
  4. You have new mail
  5. how tomcat works
  6. zbb20171215 git 版本回退
  7. html判断整数小数点后两位小数点,js控制input框只能输入数字和一位小数点且小数点后面只有两位小数...
  8. Java并发篇_volatile
  9. python办公自动化案例-Python智能办公自动化实战课程
  10. WinDbg使用摘要
  11. JAVA程序将PDF转化为TXT
  12. visio 2013安装教程
  13. 人工智能:一种现代的方法|课后习题解答
  14. Android自定义View画钟表
  15. 医学影像常用Python包
  16. html复制并弹窗提示已复制,如何调用handsome主题自带的弹窗提示实现复制弹窗提醒以及个性化提示...
  17. 宜宾学院谢江宜计算机基础题,宜宾学院2011-2012学年度下期期末公共课考试安排表.xls...
  18. 海豚湾,变态的日本银
  19. 常用期刊、会议的简称缩写(深度学习图像处理领域)
  20. 一个大一计算机学生的学期总结(2022年)

热门文章

  1. thinkphp多城市房产系统源码程序_亲测Thinkphp开源房产程序源码/多城市版房产系统 带手机版+独家教程...
  2. 传统方式解决披萨订购(工厂模式实例)
  3. 《Pocket Universe》严肃游戏介绍
  4. Java实现数字消消乐游戏项目
  5. 苹果手机能有软件测试硬件是否给更换过,如何辨别iPhone是否被更换过屏幕 鉴别iPhone手机屏幕有没有被更换过的方法...
  6. 【拆机】小米手机电源适配器
  7. 程序员如何优雅的骂人
  8. yii接口开发curd,提供全部(基础版本basic)RestfulApi
  9. 我在美国与“狼”共舞的日子(1)
  10. 代工厂发布Katana 3.0和Mari 4.1