开发团队分配管理软件
前言
開發團隊分配管理軟件項目解析
提示:以下是本篇文章正文內容,下面案例可供參考
一、了解目的
開發團隊分配管理軟件要實現什么?
1、軟件啟動時,首先進入登錄界面進行注冊和登錄功能。
2、當登陸成功后,進入菜單,首先就可以對開發人員賬戶和密碼進行修改。
3、然后可以對開發人員進行增刪改操作。
4、人員添加成功后,根據菜單提示,基于現有的公司成員,組建一個開發團隊以開發一個新的項目。
5、組建過程包括將成員插入到團隊中,或從團隊中刪除某成員,還可以列出團隊中現有成員的列表,開發團隊成員包括架構師、設計師和程序員。
6、團隊組建成功,則可以進入項目模塊,添加項目,分配開發團隊進行開發。
二、列出功能結構
三、分析軟件設計結構
(需要有幾個模塊,模塊的分類又是怎么樣的?)
我們可以這樣看:
1、首先需要顯示和操作。-------這是一個模塊,為viem塊,它是主控模塊,來實現顯示和進行一些處理操作。
2、然后,我們再看,需要有一些管理操作,那我們將他們拿出來,放到單獨的模塊,可以使編譯時更加簡明和方便。-------這是一個模塊,為service,它是實體對象,實現管理作用。
3、最后,我們實現以上操作需要對象吧,其中有屬性和行為吧,這個我們可以集中放到一個模塊里面。------這是一個模塊,為domain,用來存放一些對象和方法,或者接口。
四、操作
(根據需要和所給的一些信息,初步的將模塊和類創建好,再按每一個模塊或功能來編寫,要有條理性!)
1.domain類
其中,Employee為父類,在類中使用有參和無參構造方法來創建所需的對象,最后,一定要記得重寫toString方法,來得到規定的輸出內容。(沒有重寫toString,輸出是一個虛擬地址)
根據關系以及功能信息,再將Architect類、Designer類、Employee類、NoteBook類、PC類、Printer類、Programmer類、Programmer類
補充完整。
接下來,從信息可知,除了普通員工以外都有設備,而表格后面都顯示設備信息,所以每一個設備類都應該有一個功能就是返回自身信息,所以我們將它設計成接口。(接口實現呈現并列關系,當然都需要重寫了getDescription方法)
//接口Equipment類 public interface Equipment {/*** 接口實現呈現并列關系(都重寫了getDescription方法)** @return 自身信息*/String getDescription();}2.service類
NameListService
public class NameListService {public NameListService(){}//用來裝員工的數據集合private static ArrayList<Employee> employees = new ArrayList<>();//添加員工的idprivate static int count = 1;//初始化默認值,static {employees.add(new Employee(count, "馬云 ", 22, 3000));employees.add(new Architect(++count, "馬化騰", 32, 18000, new NoteBook("聯想T4", 6000), 60000, 5000));employees.add(new Programmer(++count, "李彥宏", 23, 7000, new PC("戴爾", "NEC 17寸")));employees.add(new Programmer(++count, "劉強東", 24, 7300, new PC("戴爾", "三星 17寸")));employees.add(new Designer(++count, "雷軍 ", 50, 10000, new Printer("激光", "佳能2900"), 5000));employees.add(new Programmer(++count, "任志強", 30, 16800, new PC("華碩", "三星 17寸")));employees.add(new Designer(++count, "柳傳志", 45, 35500, new PC("華碩", "三星 17寸"), 8000));employees.add(new Architect(++count, "楊元慶", 35, 6500, new Printer("針式", "愛普生20k"), 15500, 1200));employees.add(new Designer(++count, "史玉柱", 27, 7800, new NoteBook("惠普m6", 5800), 1500));employees.add(new Programmer(++count, "丁磊 ", 26, 6600, new PC("戴爾", "NEC17寸")));employees.add(new Programmer(++count, "張朝陽 ", 35, 7100, new PC("華碩", "三星 17寸")));employees.add(new Designer(++count, "楊致遠", 38, 9600, new NoteBook("惠普m6", 5800), 3000));}// 得到所有員工數據集合public ArrayList<Employee> getAllEmployees() {return employees;}//得到當前員工(id想得到的員工的ID)public Employee getEmployee(int id) throws TeamException {//for循環集合for (int i = 0; i < employees.size(); i++) {//if判斷集合中是否存在輸入的ID號//存在,輸出//不存在,報異常“該員工不存在”if (employees.get(i).getId() == id) {return employees.get(i);}}throw new TeamException("該員工不存在");}//員工的增加public void addEmployee() throws InterruptedException {System.out.println("請輸入需要添加的雇員的職位:");System.out.println("1(無職位)");System.out.println("2(程序員)");System.out.println("3(設計師)");System.out.println("4(架構師)");//輸入選擇,并用工具類判斷輸入是否正確為1-4String c = String.valueOf(TSUtility.readMenuSelection());//用if判斷輸入的是哪個選擇,判斷相等的實現相應的職位人員添加if (c.equals("1")) {System.out.println("`當前雇員職位分配為:無`");System.out.println("請輸入當前雇員的姓名:");String name = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary = TSUtility.readDouble();Employee employee = new Employee(++count, name, age, salary);employees.add(employee);System.out.println("人員添加成功!");TSUtility.readReturn();} else if (c.equals("2")) {System.out.println("`當前雇員職位分配為:程序員`");System.out.println("請輸入當前雇員的姓名:");String name = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary = TSUtility.readDouble();System.out.println("請為當前程序員配一臺好的臺式電腦!");PC pc = new PC().addPC();Programmer programmer = new Programmer(++count, name, age, salary, pc);employees.add(programmer);System.out.println("人員添加成功!");TSUtility.readReturn();} else if (c.equals("3")) {System.out.println("`當前雇員職位分配為:設計師`");System.out.println("請輸入當前雇員的姓名:");String name = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary = TSUtility.readDouble();System.out.println("請為當前設計師配一臺好的筆記本電腦!");NoteBook noteBook = new NoteBook().addNoteBook();System.out.println("請輸入當前設計師的獎金:");Double bonus = TSUtility.readDouble();Designer designer = new Designer(++count, name, age, salary, noteBook, bonus);employees.add(designer);System.out.println("人員添加成功!");TSUtility.readReturn();} else {System.out.println("`當前雇員職位分配為:架構師`");System.out.println("請輸入當前雇員的姓名:");String name = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary = TSUtility.readDouble();System.out.println("請為當前架構師配一臺好的打印設備:");Printer printer = new Printer().addPrinter();System.out.println("請輸入當前架構師的獎金:");Double bonus = TSUtility.readDouble();System.out.println("請輸入當前架構師的股票:");Integer stock = TSUtility.readstock();Architect architect = new Architect(++count, name, age, salary, printer, bonus, stock);employees.add(architect);System.out.println("人員添加成功!");TSUtility.readReturn();}}//員工的刪除/***本部分實現對開發人員的刪除功能* @param id* 刪除指定id的員工*/public void delEmployee(int id) {boolean flag = false;//for循環實現對集合是查找for (int i = 0; i < employees.size(); i++) {//判斷集合中是否存在id的員工if (employees.get(i).getId() == id) {//存在,刪除此id數據employees.remove(i);//再用for循環,對id之后的集合數據進行查找,并將之后的Id數據往前放一位for (i = id; i <= employees.size(); i++) {employees.get(i - 1).setId(employees.get(i - 1).getId() - 1);}flag = true;}}//如果集合中有數據,并刪除的話,初始的flag將為true,來將集合的計數值count-1,同時輸出提醒語句if (flag) {System.out.println("刪除成功!");count--;} else {//如果沒有輸入id,那么將報異常,且退回菜單try {throw new TeamException("該員工不存在");} catch (TeamException e) {e.printStackTrace();}}}/*** 員工的查看,將集合所有數據輸出展示*/public void showEmployee() throws InterruptedException {TSUtility.loadSpecialEffects();System.out.println("ID\t \t姓名\t\t年齡\t\t 工資\t \t職位\t \t狀態\t \t獎金\t\t 股票\t \t領用設備");//for循環訪問集合,并輸出for (int i = 0; i < employees.size(); i++) {System.out.println(" " + employees.get(i));}}/*** 實現對員工成員的修改,通過參數,對指定成員進行姓名、年齡、工資的修改* @param id* @throws InterruptedException*/public void modifyEmployee(int id) throws InterruptedException {boolean flag = false;// for循環訪問集合,然后聲明emp,并初始化,得到指定id的數據然后修改for (int i = 0; i < employees.size(); i++) {Employee emp = employees.get(i);if (employees.get(i).getId() == id) {System.out.print("姓名(" + emp.getName() + "):");String name = TSUtility.readString(4, emp.getName());System.out.print("年齡(" + emp.getAge() + "):");int age = Integer.parseInt(TSUtility.readString(2,emp.getAge()+""));System.out.print("工資(" + emp.getSalary() + "):");double salary =Double.parseDouble(TSUtility.readString(10, emp.getSalary()+""));emp.setName(name);emp.setAge(age);emp.setSalary(salary);employees.set(i,emp);flag = true;}}//如果集合中有數據,并修改的話,初始的flag將為true,同時輸出提醒語句if (flag) {System.out.println("修改成功!");} else {//如果沒有輸入id,那么將報異常,無法修改,且退回菜單try {throw new TeamException("該員工不存在");} catch (TeamException e) {e.printStackTrace();}}}}ProjectService
public class ProjectService {private ArrayList<Project> pro=new ArrayList<>();private int count=1;//添加項目public void addProject() throws InterruptedException {System.out.println("項目參考:--------------------------------------------------");System.out.println("1.小米官網:開發完成類似于小米官網的web項目.");System.out.println("2.公益在線商城:貓寧Morning公益商城是中國公益性在線電子商城.");System.out.println("3.博客系統:Java博客系統,讓每一個有故事的人更好的表達想法!");System.out.println("4.在線協作文檔編輯系統:一個很常用的功能,適合小組內的文檔編輯。");System.out.println("5.自定義項目");System.out.println("------------------------------------------------------------");TSUtility.readReturn();System.out.println("請輸入你想添加的項目名: ");char c = TSUtility.readMenuSelectionPro();/*** 輸入選擇項目c通過switch來將項目的信息完整填入集合*/switch (c) {case '1':Project p1 = new Project();p1.setProId(count++);p1.setProName("小米官網");p1.setDesName("開發完成類似于小米官網的web項目.");pro.add(p1);TSUtility.loadSpecialEffects();System.out.println("已添加項目:"+p1.getProName());break;case '2':Project p2 = new Project();p2.setProId(count++);p2.setProName("公益在線商城");p2.setDesName("貓寧Morning公益商城是中國公益性在線電子商城.");pro.add(p2);TSUtility.loadSpecialEffects();System.out.println("已添加項目:"+p2.getProName());break;case '3':Project p3 = new Project();p3.setProId(count++);p3.setProName("博客系統");p3.setDesName("Java博客系統,讓每一個有故事的人更好的表達想法!");pro.add(p3);TSUtility.loadSpecialEffects();System.out.println("已添加項目:"+p3.getProName());break;case '4':Project p4 = new Project();p4.setProId(count++);p4.setProName("在線協作文檔編輯系統");p4.setDesName("一個很常用的功能,適合小組內的文檔編輯。");pro.add(p4);TSUtility.loadSpecialEffects();System.out.println("已添加項目:"+p4.getProName());break;case'5':Scanner sc=new Scanner(System.in);Project p5 =new Project();p5.setProId(count++);System.out.print("請輸入自定義項目名稱:");p5.setProName(sc.nextLine());System.out.println("請輸入自定義項目內容:");p5.setDesName(sc.nextLine());pro.add(p5);TSUtility.loadSpecialEffects();System.out.println("已添加項目:"+p5.getProName());break;default:System.out.println("項目不存在");break;}}/*** 給項目分配團隊* 情況如下:* 1.添加項目沒有隊伍* 正常查看,只是沒有隊伍開發,開發狀態為false* 2.有隊伍但是沒有項目* 無法分配,無法查看* 3.添加項目后分配隊伍* 正常查看分配開發情況**/public void dealingPro(Programmer[] team){System.out.println("當前團隊有人員:");//判斷是否添加隊伍for (int i = 0; i < team.length; i++) {if(team.length==0) {System.out.println("當前沒有團隊!");break;}System.out.println(team[i]);}System.out.println("請為當前團隊創建一個團隊名稱:");String teamName = TSUtility.readKeyBoard(8, false);//隨機分配項目//先判斷是否添加項目if (pro.size()==0) {System.out.println("當前未添加項目,無法進行項目分配!");}else{System.out.println("正在進行項目分配!");Random ra = new Random();int ranNum = ra.nextInt(pro.size());Project project = this.pro.get(ranNum);project.setTeamName(teamName);project.setTeam(team);project.setStatus(true);pro.set(ranNum, project);System.out.println("項目分配完成!");}}/*** 查看目前項目情況* @throws InterruptedException*/public void showPro() throws InterruptedException {TSUtility.loadSpecialEffects();//判斷項目開發情況//如果沒有項目輸出相應語句if(pro.size()!=0) {for (int i = 0; i < pro.size(); i++) {System.out.println(pro.get(i));}}else{System.out.println("當前沒有項目信息,請先配置項目!" +"");}}/*** 刪除選擇的項目*/public void delPro(){//判斷是否有項目if (pro.size()!=0) {System.out.println("請輸入需要刪除的項目id:");int id = TSUtility.readInt();boolean flag = false;//for循環查找指定要刪除的id存不存在for (int i = 0; i < pro.size(); i++) {if (pro.get(i).getProId() == id) {pro.remove(i);//在已經刪除項目后,將之后的項目消息往前放for (i = id; i <= pro.size(); i++) {pro.get(i - 1).setProId(pro.get(i - 1).getProId() - 1);}flag = true;}}//刪除基礎上將計數count減一if (flag) {System.out.println("刪除成功!");count--;} else {//沒有項目就報異常try {throw new TeamException("該項目不存在");} catch (TeamException e) {e.printStackTrace();}}}else {System.out.println("項目為空,無法刪除!");}}//得到所有項目數據集合public ArrayList<Project> getAllPro() {return pro;} }TeamException
我們自定義異常,為了更完整的實現我們需要的功能
TeamService
public class TeamService {//用于自動生成團隊成員的memberIdprivate static int counter = 1;//團隊人數上限private final int MAX_MEMBER = 6;//保存當前團隊成員private Programmer[] team = new Programmer[MAX_MEMBER];//團隊實際人數private int total = 0;public TeamService() {}/*** 返回team中所有程序員構成的數組,total為數組的長度* @return*/public Programmer[] getTeam() {Programmer[] team = new Programmer[total];for (int i = 0; i < total; i++) {team[i] = this.team[i];}return team;}//初始化當前團隊成員數組public void clearTeam() {team = new Programmer[MAX_MEMBER];counter=1;total=0;this.team = team;}//增加團隊成員public void addMember(Employee e) throws TeamException {//判斷團隊數組是否為空if (total >= MAX_MEMBER){throw new TeamException("成員已滿,無法添加");}//判斷添加的成員是否為開發人員if (!(e instanceof Programmer)) {throw new TeamException("該成員不是開發人員,無法添加");}Programmer p = (Programmer)e;//方法判斷人員是否已經添加進團隊if (isExist(p)) {throw new TeamException("該員工已在本團隊中");}//判斷添加人員狀態是否為false,是,則已經是某團隊成員if(!p.getStatus()) {throw new TeamException("該員工已是某團隊成員");}/*** 判斷添加開發成員是否滿足團隊組成要求*/int numOfArch = 0, numOfDsgn = 0, numOfPrg = 0;for (int i = 0; i < total; i++) {if (team[i] instanceof Architect) {numOfArch++;}else if (team[i] instanceof Designer){ numOfDsgn++;}else if (team[i] instanceof Programmer){ numOfPrg++;}}if (p instanceof Architect) {if (numOfArch >= 1){throw new TeamException("團隊中至多只能有一名架構師");}} else if (p instanceof Designer) {if (numOfDsgn >= 2){throw new TeamException("團隊中至多只能有兩名設計師");}} else if (p instanceof Programmer) {if (numOfPrg >= 3){throw new TeamException("團隊中至多只能有三名程序員");}}//添加到數組p.setStatus(false);p.setMemberId(counter++);team[total++] = p;}/*** 方法判斷人員是否已經添加進團隊* @param p* @return*/private boolean isExist(Programmer p) {for (int i = 0; i < total; i++) {if (team[i].getId() == p.getId()) return true;}return false;}/*** 刪除指定memberId的員工* @param memberId* @throws TeamException*/public void removeMember(int memberId) throws TeamException {int n = 0;//找到指定memberId的員工,并刪除for (; n < total; n++) {if (team[n].getMemberId() == memberId) {team[n].setStatus(true);break;}}//如果遍歷一遍,都找不到,則報異常if (n == total)throw new TeamException("找不到該成員,無法刪除");//后面的元素覆蓋前面的元素for (int i = n + 1; i < total; i++) {team[i - 1] = team[i];}team[--total] = null;} }3.view類
LogView
public class LogView {private static String name="";private static String password="";//注冊public void zhuce() throws InterruptedException{TSUtility.loadSpecialEffects();System.out.println("?????-----開始注冊------?????");System.out.println();System.out.print("輸入注冊賬戶名稱:");name=TSUtility.readKeyBoard(8,false);System.out.print("輸入注冊賬戶密碼:");password=TSUtility.readKeyBoard(16,false);System.out.println();System.out.println(" ? ---------------------- ? ");System.out.println("注冊成功!請重新登錄!");TSUtility.loadSpecialEffects();}//登錄public void log() throws InterruptedException{Scanner sc=new Scanner(System.in);int count=5;boolean flag=true;while (flag){System.out.println("?????-----登錄頁面------?????");System.out.println();System.out.print("輸入登錄賬戶名稱:");String name1=TSUtility.readKeyBoard(8,false);System.out.print("輸入登錄密碼:");String password1= TSUtility.readKeyBoard(16,false);System.out.println();System.out.println(" ? ---------------------- ? ");TSUtility.loadSpecialEffects();//判斷是否注冊if(name.equals("")&&password.equals("")){System.out.println();System.out.println("賬號不存在,請您先注冊!");zhuce();continue;}//注冊后登錄if (name.equals(name1)&&password.equals(password1)) {System.out.println("???登錄成功!???");System.out.println();System.out.print("是否想要修改用戶登錄信息?(Y/N):");char sure=TSUtility.readConfirmSelection();if (sure == 'Y' || sure == 'y') {xiugailog();}else{System.out.println("歡迎進入軟件菜單!");break;}System.out.println();System.out.println("???登錄成功!???");TSUtility.loadSpecialEffects();break;//判斷輸入是否正確}else if(name.equals(name1)){count--;System.out.println("???密碼錯誤,你還剩"+count+"次輸入機會!???");if (count==0){System.out.println("?錯誤次數超過5次,退出系統!");break;}}else{System.out.println("???用戶名錯誤!???");}}}//修改public void xiugailog() throws InterruptedException{String name2;String password2;System.out.println();System.out.println("?????-----修改頁面------?????");System.out.println("?-----(不修改內容可按回車鍵)------?");System.out.println();System.out.print("請輸入新的用戶名("+name+"):");name2 = TSUtility.readKeyBoard1(8,false);System.out.print("請輸入新的密碼(" + password + "):");password2 = TSUtility.readKeyBoard1(16,false);System.out.println();System.out.println("?----------------------?");//判斷是否修改,修改的話將原先的數據替換if(name2.length()!=0){name=name2;}if(password2.length()!=0){password=password2;}System.out.println();System.out.println("修改成功,請重新登錄!");log();} }TeamView
public class TeamView {private static Scanner sc = new Scanner(System.in);private TeamService ts = new TeamService();private NameListService nameListSer = new NameListService();private TeamService t = new TeamService();private ArrayList<Programmer[]> team = new ArrayList<>();//團隊人員操作主界面public void enterMainMenu() throws TeamException{boolean b = true;//顯示員工成員列表while (b) {System.out.println("1-團隊列表 2-添加團隊成員 3-刪除團隊成員 4-退出");System.out.print("請選擇(1-4):");char c = TSUtility.readMenuSelection();switch (c) {case '1':listTeam();break;case '2':listAllEmployees();addMember();break;case '3'://團隊列表listTeam();deleteMember();break;case '4':System.out.print("確認是否退出(Y/N):");char c1 = TSUtility.readConfirmSelection();if (c1 == 'Y') {//在集合中添加一個團隊team.add(ts.getTeam());//格式化團隊ts.clearTeam();b = false;}break;}}}//返回集合中的團隊public ArrayList<Programmer[]> getTeam() {return team;}//顯示團隊列表private void listAllTeam(){System.out.println("\n-------------------團隊列表-------------------\n");ArrayList<Employee> allTeam = nameListSer.getAllEmployees();}//顯示員工成員列表private void listAllEmployees() {System.out.println("\n-------------------開發團隊調度軟件-------------------\n");//獲取所有員工數據集合ArrayList<Employee> allEmployees = nameListSer.getAllEmployees();if (allEmployees.size() == 0) {System.out.println("無員工信息!");} else {System.out.println("ID\t\t 姓名\t\t年齡\t \t工資\t \t職位\t \t狀態\t \t獎金\t \t股票\t \t領用設備");//循環輸出員工信息for ( Employee emp: allEmployees) {System.out.println(" " + emp);}}System.out.println("------------------------------------------------------");}//顯示團隊成員列表private void listTeam() {System.out.println("------------------團隊成員列表------------------");//獲取team中所有程序員構成的數組Programmer[] team = ts.getTeam();if (team.length == 0) {System.out.println("開發團隊目前沒有成員!");} else {System.out.println("TID/ID\t姓名\t\t年齡\t 工資\t 職位\t 獎金\t 股票");//循環輸出團隊成員信息for (int i = 0; i < team.length; i++) {System.out.println(" " + team[i].getDetailsForTeam());}}System.out.println("----------------------------------------------");}//添加團隊成員private void addMember() {System.out.println("-------------添加成員-------------");System.out.println("請輸入要添加的員工ID:");String s = sc.next();int id = TSUtility.printInt(s);//定義一個中間變量,用于判斷輸入的id值是否存在int index = -1;//判斷輸入的id值是否有意義for (int i = 0; i < nameListSer.getAllEmployees().size(); i++) {//獲取成員集合中的id,看是否存在該idif ( nameListSer.getAllEmployees().get(i).getId() == id) {//找到的id值賦值給indexindex = id;break;}}if (index == -1) {System.out.println("此id的開發成員不存在");} else {//用戶輸入的值減1index--;try {//獲取成員集合中的元素信息Employee e = nameListSer.getAllEmployees().get(index);//添加ts.addMember(e);System.out.println("添加成功");} catch (TeamException e) {System.out.println("添加失敗," + e.getMessage());}}TSUtility.readReturn();}//刪除團隊成員private void deleteMember() {if (ts.getTeam().length == 0) {System.out.println("當前無任何團隊!");} else {System.out.println("-------------刪除成員-------------");System.out.println("請輸入要刪除的員工TID:");String s = sc.next();int memberId = TSUtility.printInt(s);int index = -1;//判斷輸入的id值是否有意義for (int i = 0; i < ts.getTeam().length; i++) {if (ts.getTeam()[i].getMemberId() == memberId) {index = memberId;break;}}//初始沒有變化if (index == -1) {System.out.println("此id的團隊成員不存在");} else {//初始的index變化System.out.print("確認是否刪除(Y/N):");char c = TSUtility.readConfirmSelection();//對輸入字符判斷if (c == 'Y') {try {ts.removeMember(index);System.out.println("刪除成功");} catch (TeamException e) {System.out.println("刪除失敗," + e.getMessage());}} else System.out.println("已取消刪除");}}TSUtility.readReturn();}//查看團隊public void showTeam() {System.out.println("-----------團隊列表-----------");if (team.size() == 0) {System.out.println("當前無團隊信息");System.out.println("-----------------------------");} else {//循環團隊集合for (Programmer[] t : team) {/*創建數組,團隊集合賦值循環集合中的數組(增強for循環)輸出數組中的成員列表*/for (Programmer programmer : t) System.out.println(programmer);System.out.println("-----------------------------");} // for (int i = 0; i < team.size(); i++) { // //創建數組,團隊集合賦值 // Programmer[] t = team.get(i); // //循環集合中的數組 // for (int j = 0; j < team.get(i).length; j++) { // //輸出數組中的成員列表 // System.out.println(t[j]); // } // System.out.println("-----------------------------"); // }}}//刪除團隊public void deleteTeam() {if (team.size()==0){System.out.println("當前無團隊信息!");}else {System.out.print("請輸入想要刪除第幾個團隊:");String s = sc.next();int num = TSUtility.printInt(s);if (num <= 0 || num > team.size()) {System.out.println("輸入錯誤,當前共有" + team.size() + "個團隊");} else {//輸入的值減1num--;System.out.print("確認是否刪除(Y/N):");char c = TSUtility.readConfirmSelection();if (c == 'Y') {//創建數組,集合中的團隊賦值Programmer[] t = team.get(num);for (int i = 0; i < team.get(num).length; i++) {//修改數組中成員的狀態值t[i].setStatus(true);}team.remove(num);System.out.println("刪除成功");} else System.out.println("已取消刪除");}}TSUtility.readReturn();} }TSUtility
這是一個工具類,主要是一個對輸入的一個判斷,這個可以根據需要來自己定義
IndexView
這個是最后的顯示和操作的處理,里面是一些選擇和方法的調度。
五、總結
在本次項目中的一些問題:
1、在domain類中,注意對toString方法的重寫,根據需要來編寫;
2、在項目編寫中每部分分開來編寫,在梳理清楚流程之后,每個模塊功能完全后,最后再實現主控模塊的編寫;
3、在使用代碼塊時,注意區分有static和無static的區別;
4、注意一些代碼結構,一定要清晰,不然出錯誤之后很難查找。
總結
以上是生活随笔為你收集整理的开发团队分配管理软件的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 吴忠军 - 养生之道 老人健康长寿的大秘
- 下一篇: 如何将小程序内置非promise API