日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

实践项目1

發布時間:2024/1/8 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 实践项目1 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

項目開發團隊分配管理軟件

一、需求說明?

  • 該軟件實現以下功能: 軟件啟動時,首先進入登錄界面進行注冊和登錄功能。
  • 當登陸成功后,進入菜單,首先就可以對開發人員賬戶和密碼進行修改。
  • 然后可以對開發人員進行增刪改操作
  • 人員添加成功后,根據菜單提示,基于現有的公司成員,組建一個開發團隊以開發一個新的項目。
  • 組建過程包括將成員插入到團隊中,或從團隊中刪除某成員,還可以列出團隊中現有成員的列表,開發團隊成員包括架構師、設計師和程序員。
  • 團隊組建成功,則可以進入項目模塊,添加項目,分配開發團隊進行開發。
  • ?1.1、用戶注冊和登錄模塊

    • 定義一個LoginView類
      • 實現注冊方法
      • 如果沒有賬戶則需要注冊
    • 如果有賬號則直接進行登錄
      • 實現登錄功能
      • 判斷用戶輸入的值是否正確
      • 如果正確則進入軟件菜單 如果錯誤則重新輸入,限制次數只有5次,超過次數則程序停止,重新啟動
    • 實現修改用戶密碼功能
      • 可以實現對用戶名,密碼,或者兩者都可以進行修改即可。
    package com.team.view;public class LoginView {private String userName = "";private String password = "";//實現注冊方法public void registView() {System.out.println("開始注冊:");System.out.println("請輸入你的注冊賬戶名稱:");String userName = TSUtility.readKeyBoard(4, false);this.userName = userName;System.out.println("請輸入你的注冊密碼:");String password = TSUtility.readKeyBoard(16, false);this.password = password;System.out.println("注冊成功!請登錄!");}//實現登錄功能public void login() throws InterruptedException {int count = 3;boolean flag = true;while (flag) {System.out.println("🐱************************🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱*** ~登錄界面~ ***🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱************************🐱");System.out.println();System.out.println("請輸入你的登錄賬戶名稱:");String userName = TSUtility.readKeyBoard(4, false);System.out.println("請輸入你的登錄密碼:");String password = TSUtility.readKeyBoard(16, false);//未注冊if (this.userName.length() == 0 || this.password.length() == 0) {System.out.println("未檢測到您的賬號,請您先注冊!");registView();} else if (this.userName.equals(userName) && this.password.equals(password)) {TSUtility.loadSpecialEffects();System.out.println("登陸成功!歡迎您:" + userName);flag = false;} else {if (count <= 0) {System.out.println("登錄次數不足!強制退出!");return;} else {count--;System.out.println("登錄失敗!你的用戶名或密碼不匹配!");System.out.println("登錄次數還剩" + count + "次,請重新輸入:");System.out.println("---------------------------------");System.out.println();}}}}//實現修改用戶密碼功能public void revise() throws InterruptedException {boolean flag = true;while (flag) {System.out.println("🐱************************🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱*** ~修改界面~ ***🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱*** ***🐱");System.out.println("🐱************************🐱");System.out.println();System.out.println("請輸入你需要修改的類型:");System.out.println("1.修改用戶名");System.out.println("2.修改密碼名");System.out.println("3.修改用戶名和密碼名");System.out.println("4.不修改,退出");System.out.println("請輸入(1-4)");int chishu = TSUtility.readInt();switch (chishu) {case 1:System.out.println("請輸入你的修改的賬戶名稱(" + getUserName() + "):");String userName = TSUtility.readKeyBoard(4, false);this.userName = userName;System.out.println("修改成功!");break;case 2:System.out.println("請輸入你的修改密碼(" + getPassword() + "):");String password = TSUtility.readKeyBoard(16, false);this.password = password;System.out.println("修改成功!");break;case 3:System.out.println("請輸入你的修改的賬戶名稱(" + getUserName() + "):");String userName1 = TSUtility.readKeyBoard(4, false);this.userName = userName1;System.out.println("請輸入你的修改密碼(" + getPassword() + "):");String password1 = TSUtility.readKeyBoard(16, false);this.password = password1;System.out.println("修改成功!");break;case 4:System.out.print("確認是否退出(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'Y') {flag = false;TSUtility.loadSpecialEffects();System.out.println("退出成功");return;}default:System.out.println("輸入錯誤!請輸入(1-4)");break;}}}public String getUserName() {return userName;}public void setUserName(String userName) {this.userName = userName;}public String getPassword() {return password;}public void setPassword(String password) {this.password = password;}}

    ?2、開發人員管理模塊

  • 在domain包中完成各個類的實體類創建
    • Architect架構師實體類
    package com.team.domain;public class Architect extends Designer{//stock 表示公司獎勵的股票數量private int stock;public Architect(int id, String name, int age, double salary, Equipment equipment, double bonus, int stock) {super(id, name, age, salary, equipment, bonus);this.stock = stock;}public int getStock() {return stock;}public void setStock(int stock) {this.stock = stock;}@Overridepublic String toString() {return ObjectProperties() + "\t架構師\t" +isStatus()+ "\t" + getBonus() + "\t" + getStock() + "\t" + getEquipment().getDescription();} }
    • ?Designer 設計師實體類
    package com.team.domain;public class Designer extends Programmer {//bonus 表示獎金private double bonus;public Designer() {}public Designer(int id, String name, int age, double salary, Equipment equipment, double bonus) {super(id, name, age, salary, equipment);this.bonus = bonus;}public double getBonus() {return bonus;}public void setBonus(double bonus) {this.bonus = bonus;}@Overridepublic String toString() {return ObjectProperties() + "\t設計師\t" + isStatus() + "\t" + getBonus() + "\t\t\t" + getEquipment().getDescription();}}
    • Employee 人員類

    • package com.team.domain;public class Employee {private int id;private String name;private int age;private double salary;public Employee() {}public Employee(int id, String name, int age, double salary) {this.id = id;this.name = name;this.age = age;this.salary = salary;}public int getId() {return id;}public void setId(int id) {this.id = id;}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 getSalary() {return salary;}public void setSalary(double salary) {this.salary = salary;}public String ObjectProperties() {return id + "\t" + name + "\t" + age + "\t\t" + salary;}@Overridepublic String toString() {return ObjectProperties();} }

  • 在NameListService類中完成功能操作????
    • ????????實現員工的添加(根據職業添加(無,程序員,設計師,架構師))
      • 實現員工的查看 (顯示所有數據)
      • 實現員工的刪除(注意員工id需要動態顯示,也就是刪除后,員工id需要更新)
      • 實現員工的修改(至少修改員工的姓名,年齡,工資)

    package com.team.service;import com.team.domain.*; import com.team.view.TSUtility;import java.util.ArrayList; import java.util.Scanner;public class NameListService {private ArrayList<Employee> employees = new ArrayList<>();private int orderNumber = 1;public Scanner sc = new Scanner(System.in);public NameListService() {}//初始化{employees.add(new Employee(orderNumber, "馬云 ", 22, 3000));employees.add(new Architect(++orderNumber, "馬化騰", 32, 18000, new NoteBook("聯想T4", 6000), 60000, 5000));employees.add(new Programmer(++orderNumber, "李彥宏", 23, 7000, new PC("戴爾", "NEC 17寸")));employees.add(new Programmer(++orderNumber, "劉強東", 24, 7300, new PC("戴爾", "三星 17寸")));employees.add(new Designer(++orderNumber, "雷軍 ", 50, 10000, new Printer("激光", "佳能2900"), 5000));employees.add(new Programmer(++orderNumber, "任志強", 30, 16800, new PC("華碩", "三星 17寸")));employees.add(new Designer(++orderNumber, "柳傳志", 45, 35500, new PC("華碩", "三星 17寸"), 8000));employees.add(new Architect(++orderNumber, "楊元慶", 35, 6500, new Printer("針式", "愛普生20k"), 15500, 1200));employees.add(new Designer(++orderNumber, "史玉柱", 27, 7800, new NoteBook("惠普m6", 5800), 1500));employees.add(new Programmer(++orderNumber, "丁磊 ", 26, 6600, new PC("戴爾", "NEC17寸")));employees.add(new Programmer(++orderNumber, "張朝陽 ", 35, 7100, new PC("華碩", "三星 17寸")));employees.add(new Designer(++orderNumber, "楊致遠", 38, 9600, new NoteBook("惠普m6", 5800), 3000));}//getAllEmployees ()方法:獲取當前所有員工。//返回:包含所有員工集合public ArrayList<Employee> getAllEmployees() {return employees;}//getEmployee(id : int)方法:獲取指定ID的員工對象。//參數:指定員工的ID//返回:指定員工對象//異常:找不到指定的員工public Employee getEmployee(int id) throws TeamException {boolean flag = true;for (int i = 0; i < employees.size(); i++) {if (employees.get(i).getId() == id) {flag = false;return employees.get(i);}}while (flag) {try {throw new TeamException("找不到指定的員工");} catch (TeamException e) {e.printStackTrace();System.out.println("請重新輸入指定員工的ID");int id1 = TSUtility.readInt();getEmployee(id1);return employees.get(id1 - 1);}}return employees.get(0);}//實現員工的添加(根據職業添加(無,程序員,設計師,架構師))public void addEmployee() throws InterruptedException {System.out.println("請輸入需要添加的雇員的職位:");System.out.println("1(無職位)");System.out.println("2(程序員)");System.out.println("3(設計師)");System.out.println("4(架構師)");String c = String.valueOf(TSUtility.readMenuSelection());switch (c) {case "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(++orderNumber, name, age, salary);employees.add(employee);System.out.println("人員添加成功!");TSUtility.readReturn();break;case "2":System.out.println("`當前雇員職位分配為:程序員`");System.out.println("請輸入當前雇員的姓名:");String name1 = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age1 = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary1 = TSUtility.readDouble();System.out.println("請為當前程序員配一臺好的臺式電腦:");PC pc = new PC().addPC();Programmer programmer = new Programmer(++orderNumber, name1, age1, salary1, pc);employees.add(programmer);System.out.println("人員添加成功!");TSUtility.readReturn();break;case "3":System.out.println("`當前雇員職位分配為:設計師`");System.out.println("請輸入當前雇員的姓名:");String name2 = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age2 = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary2 = TSUtility.readDouble();System.out.println("請為當前設計師配一臺好的筆記本電腦:");NoteBook noteBook = new NoteBook().addNoteBook();System.out.println("請輸入當前設計師的獎金:");Double bonus = TSUtility.readDouble();Designer designer = new Designer(++orderNumber, name2, age2, salary2, noteBook, bonus);employees.add(designer);System.out.println("人員添加成功!");TSUtility.readReturn();break;case "4":System.out.println("`當前雇員職位分配為:架構師`");System.out.println("請輸入當前雇員的姓名:");String name3 = TSUtility.readKeyBoard(4, false);System.out.println("請輸入當前雇員的年齡:");int age3 = TSUtility.readInt();System.out.println("請輸入當前雇員的工資:");Double salary3 = TSUtility.readDouble();System.out.println("請為當前架構師配一臺好的打印設備:");Printer printer = new Printer().addPrinter();System.out.println("請輸入當前架構師的獎金:");Double bonus1 = TSUtility.readDouble();System.out.println("請輸入當前架構師的股票:");Integer stock = TSUtility.readstock();Architect architect = new Architect(++orderNumber, name3, age3, salary3, printer, bonus1, stock);employees.add(architect);System.out.println("人員添加成功!");TSUtility.readReturn();break;default:System.out.println("重新輸入");addEmployee();}}//實現員工的修改(至少修改員工的姓名,年齡,工資)public void changeEmployee(int id) throws InterruptedException {boolean flag = false;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;}}if (flag) {System.out.println("修改成功!");} else {try {throw new TeamException("找不到指定的員工");} catch (TeamException e) {e.printStackTrace();System.out.println("請重新輸入指定員工的ID");int id1 = TSUtility.readInt();changeEmployee(id1);}}}//實現員工的刪除(注意員工id需要動態顯示,也就是刪除后,員工id需要更新)public void delEmployee(int id) throws InterruptedException {boolean flag = false;for (int i = 0; i < employees.size(); i++) {if (employees.get(i).getId() == id) {employees.remove(i);for (i = id; i <= employees.size(); i++) {employees.get(i - 1).setId(employees.get(i - 1).getId() - 1);}flag = true;}}if (flag) {System.out.println("刪除成功!");orderNumber--;} else {try {throw new TeamException("該員工不存在");} catch (TeamException e) {e.printStackTrace();System.out.println("請重新輸入指定員工的ID");int id1 = TSUtility.readInt();delEmployee(id1);}}}//查看員工列表public void showEmployee() throws InterruptedException {TSUtility.loadSpecialEffects();System.out.println("ID\t 姓名\t年齡\t 工資\t 職位\t 狀態\t 獎金\t 股票\t 領用設備");for (int i = 0; i < employees.size(); i++) {System.out.println(" " + employees.get(i));}} }

    ?3、開發團隊調度管理模塊

    package com.team.view;import com.team.domain.Employee; import com.team.domain.Programmer; import com.team.domain.Project; import com.team.service.NameListService; import com.team.service.ProjectService; import com.team.service.TeamException; import com.team.service.TeamService;import java.util.ArrayList;public class TeamView {private NameListService ListSvc = new NameListService();private TeamService teamSvc = new TeamService();ArrayList<Programmer[]> team = new ArrayList<>();//進入界面public void enterMainMenu() throws TeamException {boolean loopFlag = true;char key = 0;do {if (key != '1') {listAllEmlpoyees();}System.out.println("1-團隊列表 2-添加團隊成員 3-刪除團隊成員 4-退出");System.out.print("請選擇(1-4)");key = TSUtility.readMenuSelection();System.out.println();switch (key) {case '1':ListTeam();break;case '2':addMember();break;case '3':deleteMember();break;case '4':System.out.println("請確認是否要退出(Y/N)");char ch = TSUtility.readConfirmSelection();if (ch == 'Y') {team.add(teamSvc.getTeam());teamSvc.clearTeam();loopFlag = false;}break;default:System.out.println("輸入信息有誤,請重新輸入");break;}} while (loopFlag);}//顯示所有員工成員private void listAllEmlpoyees() {System.out.println("\n-----------------------開發團隊調度軟件----------------------------\n");ArrayList<Employee> emps = ListSvc.getAllEmployees();if (emps.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\t領用設備");}for (Employee e : emps) {//增強for循環System.out.println(" " + e);}System.out.println("--------------------------------------------------------------------");}//顯示開發團隊成員列表private void ListTeam() {System.out.println("--------------團隊成員列表------------");Programmer[] team = teamSvc.getTeam();if (team.length == 0) {System.out.println("開發團隊目前沒有成員");} else {System.out.println("TID\t\t姓名\t\t年齡\t工資\t職位\t獎金\t股票");}//增強for循環System.out.println("---------------------------------");for (Programmer p : team) {System.out.println(" " + p.toString());}System.out.println("----------------------------------");}//添加成員到團隊private void addMember() throws TeamException {System.out.println("-------------添加團隊成員-------------------");System.out.println("請輸入要添加的成員ID");int id = TSUtility.readInt();try {Employee e = ListSvc.getEmployee(id);teamSvc.addMember(e);System.out.println("添加成功");} catch (TeamException e) {System.out.println("添加失敗,原因是" + e.getMessage());}//回車繼續TSUtility.readReturn();}//從團隊中刪除指定位置的成員private void deleteMember() {System.out.println("--------------刪除成員-------------");System.out.println("請入要刪除的員工TID");int TID = TSUtility.readInt();if (TID < 1) {try {throw new TeamException("不存在該員工的TID");} catch (TeamException e) {System.out.println(e.getMessage());}}System.out.println("請確認是否刪除(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());}TSUtility.readReturn();}//加入并得到更多的團隊public ArrayList<Programmer[]> getManyteam() throws TeamException {boolean flag = true;char key = 0;do {System.out.println("***************************");System.out.println("** **");System.out.println("** 團隊調度界面 **");System.out.println("** **");System.out.println("***************************");System.out.println("1-添加團隊 2-查看團隊 3-刪除團隊 4-退出");System.out.print("請選擇(1-4)");key = TSUtility.readMenuSelection();switch (key) {case '1':enterMainMenu();break;case '2'://加強for循環該怎么用System.out.println("-----團隊列表-----");for (Programmer[] team : team) {for (int i = 0; i < team.length; i++) {System.out.println(team[i]);}System.out.println("------------");teamSvc.clearTeam();}if (team.size() == 0) {System.out.println("當前無團隊,請先添加團隊");}break;case '3':if (team.size() == 0) {try {throw new TeamException("當前無團隊,請先添加團隊");} catch (TeamException e) {System.out.println(e.getMessage());}}if (team.size() != 0) {System.out.println("請輸入要刪除第幾個團隊");int num = TSUtility.readstock();if (num <= team.size()) {System.out.print("請確認是否刪除(Y/N)");char de = TSUtility.readConfirmSelection();if (de == 'Y') {//釋放團隊Programmer[] programmer =team.get(num-1);for (int i = 0; i <team.get(num-1).length ; i++) {programmer[i].setStatus(true);}team.remove(num-1);//釋放團隊名稱Project project = ProjectService.getPro().get(num-1);project.setTeam(new Programmer[0]);project.setTeamName(null);project.setStatus(false);ProjectService.getPro().set(num-1,project);} else {System.out.println("請考慮清楚");}} else {System.out.println("沒有該團隊,請正常輸入!" + "目前團隊只有" + team.size() + "個");}}break;case '4':System.out.println("是否退出(Y/N)");char yn = TSUtility.readConfirmSelection();if (yn == 'Y') { // team.add(teamSvc.getTeam());flag = false;}break;default:System.out.println("輸入信息有誤,請重新輸入");break;}} while (flag);return team;} }

    4、開發項目管理模塊

    package com.team.domain;public class Project {// 項目號 proId int-private int proID;// 項目名稱 projectName Stringprivate String projectName;//- 項目描述 desName Stringprivate String desName;//- 開發團隊 team Programmer[]-private Programmer[] team = new Programmer[10];//開發團隊名稱 teamName String-private String teamName;// 開發狀態 status false(true為開發中,false為未開發中))private boolean status = false;public Project() {}public Project(int proID, String projectName, String desName, Programmer[] team, String teamName, boolean status) {this.proID = proID;this.projectName = projectName;this.desName = desName;this.team = team;this.teamName = teamName;this.status = status;}public int getProID() {return proID;}public void setProID(int proID) {this.proID = proID;}public String getProjectName() {return projectName;}public void setProjectName(String projectName) {this.projectName = projectName;}public String getDesName() {return desName;}public void setDesName(String desName) {this.desName = desName;}public Programmer[] getTeam() {return team;}public void setTeam(Programmer[] team) {this.team = team;}public String getTeamName() {return teamName;}public void setTeamName(String teamName) {this.teamName = teamName;}public boolean isStatus() {return status;}public void setStatus(boolean status) {this.status = status;}@Overridepublic String toString() {return proID + "\t" + "項目名稱:" + projectName + "\t 內容為:" + desName + "\t團隊名稱" + teamName + "開發狀態是:" + status;} }

    5、IndexView類的設計

    package com.team.view; import com.team.domain.Programmer; import com.team.service.NameListService; import com.team.service.ProjectService; import com.team.service.TeamException;import java.util.ArrayList;public class IndexView {/*** 顏色特效*/public static final String ANSI_RESET = "\u001B[0m";public static final String ANSI_GREEN = "\u001B[32m";public static final String ANSI_YELLOW = "\u001B[33m";public static final String ANSI_PURPLE = "\u001B[35m";public static final String ANSI_BLUE = "\u001B[34m";public static final String ANSI_CYAN = "\u001B[36m";private LoginView loginVi = new LoginView();private NameListService nameListSer = new NameListService();private TeamView teamVi = new TeamView();private ProjectService projectSer = new ProjectService();private ArrayList<Programmer[]> manyTeam=null;public ProjectService getProjectSer() {return projectSer;}public void setProjectSer(ProjectService projectSer) {this.projectSer = projectSer;}public void menu() throws InterruptedException, TeamException {boolean loopFlag = true;char key = 0;System.out.println(ANSI_PURPLE);System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");System.out.println("🔣 🔣");System.out.println("🔣 🔣");System.out.println("🔣 歡迎來到項目開發團隊分配管理軟件 🔣");System.out.println("🔣 🔣");System.out.println("🔣 🔣");System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");System.out.println("🐕");System.out.println("🐕");System.out.println("🐕");System.out.println("🐕-----------<請您先進行登錄>-------------🐕");TSUtility.readReturn();try {loginVi.login();} catch (InterruptedException e) {e.printStackTrace();}do {System.out.println(ANSI_RESET + ANSI_CYAN);System.out.println("🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣🔣");System.out.println("🔣 🔣");System.out.println("🔣 🔣");System.out.println("🔣 ~軟件主菜單~ 🔣");System.out.println("🔣 🔣");System.out.println("🔣 🔣");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("?請選擇: ");System.out.print(ANSI_RESET);key = TSUtility.readMenuSelectionPro();switch (key) {case '1':try {loginVi.revise();} catch (InterruptedException e) {e.printStackTrace();}break;case '2':try {nameListSer.showEmployee();} catch (InterruptedException e) {e.printStackTrace();}boolean loopFlagSec = true;char keySec = 0;do {System.out.print(ANSI_RESET + ANSI_YELLOW);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("?請選擇: ");keySec=TSUtility.readMenuSelectionPro();switch (keySec) {case '1':try {nameListSer.addEmployee();} catch (InterruptedException e) {e.printStackTrace();}break;case '2':try {nameListSer.showEmployee();} catch (InterruptedException e) {e.printStackTrace();}break;case '3':System.out.println("請輸入需要修改的員工id:");int i = TSUtility.readInt();try {nameListSer.changeEmployee(i);} catch (InterruptedException e) {e.printStackTrace();}break;case '4':System.out.println("請輸入需要刪除的員工id:");int j = TSUtility.readInt();nameListSer.delEmployee(j);break;case '5':System.out.print("確認是否退出(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'Y') {loopFlagSec = false;}default:System.out.println("輸入有誤!請重新輸入!");break;}} while (loopFlagSec);break;case '3':try{manyTeam=teamVi.getManyteam();}catch (Exception e){e.printStackTrace();}break;case '4':boolean loopFlagThr = true;char keyThr = 0;do {System.out.print(ANSI_RESET + ANSI_GREEN);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("?請選擇: ");System.out.print(ANSI_RESET + ANSI_YELLOW);keyThr=TSUtility.readMenuSelectionPro();switch (keyThr) {case '1':try {projectSer.addProject();} catch (InterruptedException e) {e.printStackTrace();}break;case '2':try {if (manyTeam==null){System.out.println("沒有團隊,請先添加團隊");}else {if (projectSer.getPro().size()==0){System.out.println("有"+manyTeam.size()+"個團隊,沒項目,請先添加項目");} else if (projectSer.getPro().size()<manyTeam.size()) {System.out.println("請再去添加"+(manyTeam.size()-projectSer.getPro().size())+"個項目任務");} else {for (Programmer[] pro : manyTeam) {projectSer.dealingPro(pro);}}}}catch (NullPointerException e){e.printStackTrace();}break;case '3':try {projectSer.showPro();} catch (InterruptedException e) {e.printStackTrace();}break;case '4':System.out.println("請輸入需要刪除的項目id:");int j = TSUtility.readInt();projectSer.delPro(j);break;case '5':System.out.print("確認是否退出(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'Y') {loopFlagThr = false;}break;default:System.out.println("輸入有誤!請重新輸入!");break;}} while (loopFlagThr);break;case '5':System.out.print("確認是否退出(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'Y') {loopFlag = false;}break;default:break;}} while (loopFlag);}public static void main(String[] args) throws InterruptedException, TeamException {new IndexView().menu();} }

    其他代碼已打包放入百度網盤里

    鏈接:https://pan.baidu.com/s/1k1JlMkF733uZOWHGWFRINw?
    提取碼:2202

    總結

    在刪除隊伍團隊的時候需要釋放團隊里的團隊成員,并且也需要釋放相對應的團隊名稱的信息。在運行的時候將可能出現的問題即使應用try,catch來進行把任務接收進行對其的更改。對于隨機分配項目的時候需要考慮有重復的分配,導致不能將全部的任務進行分配。

    總結

    以上是生活随笔為你收集整理的实践项目1的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。