当前位置: 首页 > news >正文

企业营销网站建设费用预算/网站建设方案及报价

企业营销网站建设费用预算,网站建设方案及报价,详情图模板,58同城做公司网站怎修改文章目录前言一、项目要求1.总体要求2.添加团队成员3.删除团队成员4.团队列表二、软件结构设计1.整体设计思路2.com.atguigu.team.domain模块设计2.1 Equipment接口及其各实现子类的设计2.2 Employee类及其各子类的设计3.com.atguigu.team.service模块设计3.1 NameListService类…

文章目录

  • 前言
  • 一、项目要求
    • 1.总体要求
    • 2.添加团队成员
    • 3.删除团队成员
    • 4.团队列表
  • 二、软件结构设计
    • 1.整体设计思路
    • 2.com.atguigu.team.domain模块设计
    • 2.1 Equipment接口及其各实现子类的设计
    • 2.2 Employee类及其各子类的设计
    • 3.com.atguigu.team.service模块设计
    • 3.1 NameListService类的设计
    • 3.2 TeamService类的设计
    • 4.实现view包中类
  • 总结


前言

模拟实现一个基于文本界面的《开发团队调度软件》
熟悉Java面向对象的高级特性,进一步掌握编程技巧和调试技巧


一、项目要求

1.总体要求

本软件采用单级菜单方式工作。当软件运行时,主界面显示公司成员的列表,如下:
在这里插入图片描述

2.添加团队成员

当选择“添加团队成员”菜单时,将执行从列表中添加指定(通过ID)成员到开发团队的功能:
在这里插入图片描述
如果添加操作因某种原因失败,将显示类似以下信息(失败原因视具体原因而不同):
在这里插入图片描述
失败信息包含以下几种:
成员已满,无法添加
该成员不是开发人员,无法添加
该员工已在本开发团队中
该员工已是某团队成员
该员正在休假,无法添加
团队中至多只能有一名架构师
团队中至多只能有两名设计师
团队中至多只能有三名程序员

3.删除团队成员

当选择“删除团队成员”菜单时,将执行从开发团队中删除指定(通过TeamID)成员的功能:
在这里插入图片描述
删除成功后,按回车键将重新显示主界面。

4.团队列表

当选择“团队列表”菜单时,将列出开发团队中的现有成员,例如:
在这里插入图片描述

二、软件结构设计

1.整体设计思路

该软件由以下三个模块组成:
在这里插入图片描述
com.atguigu.team.view模块为主控模块,负责菜单的显示和处理用户操作
com.atguigu.team.service模块为实体对象(Employee及其子类如程序员等)的管理模块, NameListService和TeamService类分别用各自的数组来管理公司员工和开发团队成员对象
domain模块为Employee及其子类等JavaBean类所在的包

2.com.atguigu.team.domain模块设计

com.atguigu.team.domain模块中包含了所有实体类:
在这里插入图片描述

2.1 Equipment接口及其各实现子类的设计

在这里插入图片描述

package com.atguigu.team.domain;public interface Equipment {public abstract String getDescription();}
package com.atguigu.team.domain;public class PC implements Equipment {private String model;// 机器型号private String display;// 显示器名称public PC() {super();}public PC(String model, String display) {super();this.model = model;this.display = display;}public String getModel() {return model;}public void setModel(String model) {this.model = model;}public String getDisplay() {return display;}public void setDisplay(String display) {this.display = display;}@Overridepublic String getDescription() {return model + "(" + display + ")";}}
package com.atguigu.team.domain;public class Notebook implements Equipment {private String model;//机器型号private double price;//价格public String getModel() {return model;}public void setModel(String model) {this.model = model;}public double getPrice() {return price;}public void setPrice(double price) {this.price = price;}public Notebook() {super();}public Notebook(String model, double price) {super();this.model = model;this.price = price;}@Overridepublic String getDescription() {return model + "(" + price + ")";}}
package com.atguigu.team.domain;public class Printer implements Equipment {private String name;// 机器型号private String type;// 机器类型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;}public Printer() {super();}public Printer(String name, String type) {super();this.name = name;this.type = type;}@Overridepublic String getDescription() {return name + "(" + type + ")";}}

2.2 Employee类及其各子类的设计

在这里插入图片描述

package com.atguigu.team.domain;public class Employee {private int id;private String name;private int age;private double 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 Employee() {super();}public Employee(int id, String name, int age, double salary) {super();this.id = id;this.name = name;this.age = age;this.salary = salary;}}
package com.atguigu.team.domain;import com.atguigu.team.service.Status;public class Programmer extends Employee {private int memberId;// 团队中的IDprivate Status status;// 状态private Equipment equipment;public Programmer() {super();}public Programmer(int id, String name, int age, double salary, Equipment equipment) {super(id, name, age, salary);this.equipment = equipment;}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;}}

在这里插入图片描述

package com.atguigu.team.domain;public class Designer extends Programmer {private double bonus;// 奖金public Designer() {super();}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;}}
package com.atguigu.team.domain;public class Architect extends Designer {private int stock;// 股票public Architect() {super();}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;}}

3.com.atguigu.team.service模块设计

功能:关于开发团队成员的管理:添加、删除等。
说明:

counter为静态变量,用来为开发团队新增成员自动生成团队中的唯一ID,即memberId。(提示:应使用增1的方式)

MAX_MEMBER:表示开发团队最大成员数

team数组:用来保存当前团队中的各成员对象

total:记录团队成员的实际人数

在这里插入图片描述

getTeam()方法:返回当前团队的所有对象
返回:包含所有成员对象的数组,数组大小与成员人数一致

addMember(e: Employee)方法:向团队中添加成员
参数:待添加成员的对象
异常:添加失败, TeamException中包含了失败原因

removeMember(memberId: int)方法:从团队中删除成员
参数:待删除成员的memberId
异常:找不到指定memberId的员工,删除失败

3.1 NameListService类的设计

功能:负责将Data中的数据封装到Employee[]数组中,同时提供相关操作Employee[]的方法。
在这里插入图片描述

package com.atguigu.team.service;import com.atguigu.team.domain.Architect;
import com.atguigu.team.domain.Designer;
import com.atguigu.team.domain.Employee;
import com.atguigu.team.domain.Equipment;
import com.atguigu.team.domain.Notebook;
import com.atguigu.team.domain.PC;
import com.atguigu.team.domain.Printer;
import com.atguigu.team.domain.Programmer;import static com.atguigu.team.service.Data.*;/*** * @Description 负责将Data中的数据封装在Employee[]数组中,同时提供相关操作Employee[]的方法* @author SCU_zhangxiao Email:zhangx6512@163.com* @version v1.0* @date 2021年5月14日上午8:50:29**/
public class NameListService {private Employee[] employees;/*** 给employees及数组元素进行初始化*/public NameListService() {employees = new Employee[EMPLOYEES.length];for (int i = 0; i < employees.length; i++) {// 获取通用的属性int type = Integer.parseInt(EMPLOYEES[i][0]);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]);//Equipment eq;double bonus;int stock;switch (type) {case EMPLOYEE:employees[i] = new Employee(id, name, age, salary);break;case PROGRAMMER:eq = createEquipment(i);employees[i] = new Programmer(id, name, age, salary, eq);break;case DESIGNER:eq = createEquipment(i);bonus = Integer.parseInt(EMPLOYEES[i][5]);employees[i] = new Designer(id, name, age, salary, eq, bonus);break;case ARCHITECT:eq = createEquipment(i);bonus = Integer.parseInt(EMPLOYEES[i][5]);stock = Integer.parseInt(EMPLOYEES[i][6]);employees[i] = new Architect(id, name, age, salary, eq, bonus,stock);break;}}}/*** 
* @Description 获取指定index位置上的员工的设备
* @author SCU_zhangxiao
* @date 2021年5月14日上午9:29:10
* @param index
* @return*/private Equipment createEquipment(int index) {int type = Integer.parseInt(EQUIPMENTS[index][0]);switch (type) {case PC:return new PC(EQUIPMENTS[index][1], EQUIPMENTS[index][2]);case NOTEBOOK:int price = Integer.parseInt(EQUIPMENTS[index][2]);return new Notebook(EQUIPMENTS[index][1], price);case PRINTER:return new Printer(EQUIPMENTS[index][1], EQUIPMENTS[index][2]);}return null;}/*** * @Description 获取当前所有的员工* @author SCU_zhangxiao* @date 2021年5月21日下午3:15:33* @return*/public Employee[] getAllEmployees() {return employees;}/*** * @Description 获取指定ID的员工对象* @author SCU_zhangxiao* @date 2021年5月21日下午3:54:34* @param id* @return*/public Employee getEmployee(int id) throws TeamException{for(int i = 0;i < employees.length;i++){if(employees[i].getId()==id){return employees[i];}}throw new TeamException("找不到指定的员工");}}

3.2 TeamService类的设计

功能:关于开发团队成员的管理:添加、删除等。
在这里插入图片描述

package com.atguigu.team.service;import com.atguigu.team.domain.Architect;
import com.atguigu.team.domain.Designer;
import com.atguigu.team.domain.Employee;
import com.atguigu.team.domain.Programmer;/*** 
* @Description 关于开发团队成员的管理:添加、删除等
* @author SCU_zhangxiao  Email:zhangx6512@163.com
* @version
* @date 2021年5月21日下午4:31:04
**/
public class TeamService {private static int counter = 1;private final int MAX_MEMBER = 5;private Programmer[] team = new Programmer[MAX_MEMBER];private int total;public TeamService(){super();}/*** * @Description 获取开发团队中的所有成员* @author SCU_zhangxiao* @date 2021年5月21日下午4:46:20* @return*/public Programmer[] getTeam(){Programmer[] team = new Programmer[total];for(int i = 0;i <team.length;i++){team[i] = this.team[i];}return team;}/*** * @Description 将指定的员工添加到开发团队中* @author SCU_zhangxiao* @date 2021年5月21日下午5:04:39* @param e*/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("BUSY".equals(p.getStatus().getNAME())){throw new TeamException("该员工已是某团队成员");}else if("VOCATION".equalsIgnoreCase(p.getStatus().getNAME())){throw new TeamException("该员工正在休假,无法添加");}int numOfArch = 0,numOfDes = 0,numOfPro = 0;for(int i = 0;i < total;i++){if(team[i] instanceof Architect){numOfArch++;}else if(team[i] instanceof Designer){numOfDes++;}else if(team[i] instanceof Programmer){numOfPro++;}}if(p instanceof Architect){if(numOfArch >= 1){throw new TeamException("团队中至多只能有一名架构师");}else if(p instanceof Designer){if(numOfDes >= 2){throw new TeamException("团队中至多只能有两名设计师");}}else if(p instanceof Programmer){if(numOfPro >= 3){throw new TeamException("团队中至多只能有三名程序员");}}}//将p添加到现有的team中team[total++] = p;//p的属性赋值p.setStatus(Status.BUSY);p.setMemberId(counter++);}/*** * @Description 判断指定的员工是否已经存在于现有的开发团队中* @author SCU_zhangxiao* @date 2021年5月25日上午10:04:00* @param e* @return*/private boolean isExist(Employee e){// TODO Auto-generated method stubfor(int i = 0;i<total;i++){if(team[i].getId()==e.getId()){return true;}}return false;}public void removeMember(int memberId){}}

4.实现view包中类

package com.atguigu.team.view;import com.atguigu.team.domain.*;
import com.atguigu.team.service.*;public class TeamView {private NameListService listSvc = new NameListService();private TeamService teamSvc = new TeamService();public void enterMainMenu() {boolean loopFlag = true;char key = 0;do {if (key != '1') {listAllEmployees();}System.out.print("1-团队列表  2-添加团队成员  3-删除团队成员 4-退出   请选择(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.print("确认是否退出(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'Y')loopFlag = false;break;}} while (loopFlag);}// 显示所有的员工成员private void listAllEmployees() {System.out.println("\n-------------------------------开发团队调度软件--------------------------------\n");Employee[] emps = listSvc.getAllEmployees();if (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.print("请输入要添加的员工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();}// 从团队中删除指定id的成员private void deleteMember() {System.out.println("---------------------删除成员---------------------");System.out.print("请输入要删除员工的TID:");int id = TSUtility.readInt();System.out.print("确认是否删除(Y/N):");char yn = TSUtility.readConfirmSelection();if (yn == 'N')return;teamSvc.removeMember(id);System.out.println("删除成功");// 按回车键继续...TSUtility.readReturn();}public static void main(String[] args) {TeamView view = new TeamView();view.enterMainMenu();}
}

总结

本文基于Java编程,介绍了“开发团队调度系统”的设计,实现团队员工的增加、删除、显示等功能。

http://www.jmfq.cn/news/5245507.html

相关文章:

  • 网站的开发流程分哪几步/百度推广服务
  • CMS源码就可以做网站吗/电脑培训学校哪家好
  • 网站设计遇到的问题/石家庄seo公司
  • 移动端网站和app区别/英文seo
  • 长春优化/seo流量增长策略
  • 冒用公司名义做网站/外贸建站推广公司
  • 阳江网站建设公司/平台网站开发公司
  • 上海简约网站建设公司/抖音seo软件
  • 武汉google网站制作/ks免费刷粉网站推广
  • 建新网站开发流程图/做一个公司网站需要多少钱
  • wordpress分享计数/绍兴seo
  • 网站开发需要什么语言/全国31省市疫情最新消息今天
  • 小程序源码抓取工具/南宁百度seo推广
  • 莫企业网站建设方案/网络营销方法有哪些举例
  • 手表电商网站/广州网站优化推广方案
  • 标准化信息网站建设与应用/优化网站标题名词解释
  • 免费室内装修3d设计软件/搜索引擎优化的英文缩写
  • 简单的网站建设企业/今天最新的新闻头条
  • 福田做棋牌网站建设哪家公司便宜/百度极速版下载安装最新版
  • 佛山网站建设企业/百度上海总部
  • c 做网站性能怎么样/韩国最新新闻
  • 商业授权/seo搜索引擎优化视频
  • 赣州做网站jx25/长春网站seo哪家好
  • 哪里网站建设联系/口碑营销什么意思
  • 贵阳网站建设哪家好/培训推广 seo
  • 网站做邮箱吗/软文推广案例大全
  • 做宣传册参考网站/google官网下载安装
  • 深圳外贸建站模版/企业在线培训平台
  • 网站规划书包含哪些内容/2345网址导航浏览器下载
  • 南京便宜网站建设/在线排名优化