员工管理系统Map版
来源:互联网 发布:腾讯公司发展数据 编辑:程序博客网 时间:2024/05/16 01:03
员工信息的基本情况
普通员工
属性:员工编号、员工姓名、员工职务、请假天数、基本工资
普通员工工资:
在基本工资的基础上增加10%的工作餐,50%的岗位补助,200元住房补助
基本工资+基本工资*0.1+基本工资*0.5+200
经理
属性:员工编号、员工姓名、员工职务、请假天数、基本工资
经理工资:
在基本工资的基础上增加20%的工作餐,50%的岗位补助,500元住房补助
基本工资+基本工资*0.2+基本工资*0.5+500
董事
属性:员工编号、员工姓名、员工职务、请假天数、基本工资
董事工资:
在基本工资的基础上增加8%的工作餐,30%的岗位补助,2000元住房补助,3000元投资补助
基本工资+基本工资*0.08+基本工资*0.3+2000+3000
工资扣除部分,所有员工都一样
无请假,基本工资全发,有请假,扣除每天平均工资 * 请假天数
Employee类:/** * @author 作者 E-mail: * @date 创建时间:2017年8月14日下午2:59:15 * @version 1.0 * @description 员工管理* @parameter * @since * @return */public class Employee {private String ID;//员工编号private String name;//员工姓名private String position;//员工职务private int holiday;//请假天数private double salary;//基本工资public Employee() {super();}public Employee(String iD, String name, String position, int holiday, double salary) {super();ID = iD;this.name = name;this.position = position;this.holiday = holiday;this.salary = salary;}public String getID() {return ID;}public void setID(String iD) {ID = iD;}public String getName() {return name;}public void setName(String name) {this.name = name;}public String getPosition() {return position;}public void setPosition(String position) {this.position = position;}public int getHoliday() {return holiday;}public void setHoliday(int holiday) {this.holiday = holiday;}public double getSalary() {return salary;}public void setSalary(double salary) {this.salary = salary;}@Overridepublic String toString() {return "编号:" + ID + "\t姓名:" + name + "\t职务:" + position + "\t请假天数:" + holiday + "\t工资:"+ sumSalary();}//工资计算方法public double sumSalary(){return salary - salary/30*holiday;}//显示详细信息public void display(){}}CommonEmployee类:
/** * @author 作者 E-mail: * @date 创建时间:2017年8月14日下午2:59:51 * @version 1.0 * @description 普通员工* @parameter * @since * @return */public class CommonEmployee extends Employee {private double commonSalary;public CommonEmployee(String iD, String name, String position, int holiday, double salary) {super(iD, name, position, holiday, salary);commonSalary = 0;}public CommonEmployee() {super();}@Overridepublic double sumSalary() {double base = super.sumSalary();commonSalary = base + getSalary()*0.1+getSalary()*0.5+200; return commonSalary;}@Overridepublic void display() {System.out.println("编号:" + super.getID() + "\t姓名:" + super.getName() + "\t职务:" + super.getPosition() + "\t请假天数:" + super.getHoliday() + "\t工资:"+ sumSalary());}}Manager类:
/** * @author 作者 E-mail: * @date 创建时间:2017年8月14日下午3:00:05 * @version 1.0 * @description 经理* @parameter * @since * @return */public class Manager extends Employee{private double managerSalary;public Manager() {super();}public Manager(String iD, String name, String position, int holiday, double salary) {super(iD, name, position, holiday, salary);managerSalary = 0;}@Overridepublic double sumSalary() {double base = super.sumSalary();managerSalary = base + getSalary()*0.2+getSalary()*0.5+500;return managerSalary;}@Overridepublic void display() {System.out.println("编号:" + super.getID() + "\t姓名:" + super.getName() + "\t职务:" + super.getPosition() + "\t请假天数:" + super.getHoliday() + "\t工资:"+ sumSalary());}}Director类:
/** * @author 作者 E-mail: * @date 创建时间:2017年8月14日下午3:00:41 * @version 1.0 * @description 董事* @parameter * @since * @return */public class Director extends Employee {private double directorSalary;public Director(String iD, String name, String position, int holiday, double salary) {super(iD, name, position, holiday, salary);directorSalary = 0;}public Director() {super();}@Overridepublic double sumSalary() {double base = super.sumSalary();directorSalary = base+getSalary()*0.08+getSalary()*0.3+2000+3000;return directorSalary;}@Overridepublic void display() {System.out.println("编号:" + super.getID() + "\t姓名:" + super.getName() + "\t职务:" + super.getPosition() + "\t请假天数:" + super.getHoliday() + "\t工资:"+ sumSalary());}}TestEMD类:
import java.util.Collection;import java.util.HashMap;import java.util.Iterator;import java.util.Map;import java.util.Scanner;/** * @author 作者 E-mail: * @date 创建时间:2017年8月14日下午3:01:01 * @version 1.0 * @description* @parameter * @since * @return */public class TestEMD {static Scanner sc = new Scanner(System.in);static Map<String, Employee> map = new HashMap<>();public static void main(String[] args) {MainUI();}static void MainUI(){System.out.println("|-------------------|");System.out.println("|------1 增加-------|");System.out.println("|------2 删除-------|");System.out.println("|------3 修改-------|");System.out.println("|------4 查询-------|");System.out.println("|------0 退出-------|");System.out.println("|-------------------|");System.out.println("请选择业务:");int sele = sc.nextInt();switch (sele) {case 1://增addEmployee();break; case 2://删 delEmployee();break; case 3://改 updateEmployee();break; case 4://查 queryEmployee();break; case 0://退出 sc.close(); System.out.println("谢谢使用"); System.exit(0);break;default:System.out.println("请按要求输入!");MainUI();break;}}/** * 添加员工 */private static void addEmployee() {Employee employee;System.out.println("请输入员工编号:");Scanner scanner = new Scanner(System.in);String ID = scanner.nextLine();System.out.println("请输入员工姓名:");String name = scanner.nextLine();System.out.println("请输入员工职务(普通员工,经理,董事长):");String position = scanner.nextLine();System.out.println("请输入员工请假天数:");int holiday = scanner.nextInt();System.out.println("请输入员工基本工资:");double salary = scanner.nextDouble();switch (position) {case "普通员工":employee = new CommonEmployee(ID, name, position, holiday, salary);map.put(ID, employee);System.out.println("添加数据成功");employee.display();break;case "经理":employee = new Manager(ID, name, position, holiday, salary);map.put(ID, employee);System.out.println("添加数据成功");employee.display();break;case "董事长":employee = new Director(ID, name, position, holiday, salary);map.put(ID, employee);System.out.println("添加数据成功");employee.display();break;default:break;}System.out.println("已有员工:");for (Employee employee2 : map.values()) {employee2.display();}MainUI();}/** * 删除员工 */private static void delEmployee() {Scanner scanner = new Scanner(System.in);System.out.println("请输入员工姓名:");String name = scanner.nextLine();Collection<Employee> values = map.values();Iterator<Employee> iterator = values.iterator();while (iterator.hasNext()) {Employee employee = (Employee) iterator.next();if (employee.getName().equals(name)) {employee.display();System.out.println("确认删除?(1.是2.否)");int n = scanner.nextInt();if (n==1) {map.remove(employee.getID());System.out.println("删除成功");MainUI();}else {MainUI();}}}System.out.println("无此员工");MainUI();}/** * 修改员工信息 */private static void updateEmployee() {System.out.println("请输入修改员工姓名:");Scanner scanner = new Scanner(System.in);String name = scanner.nextLine();Collection<Employee> values = map.values();Iterator<Employee> iterator = values.iterator();while (iterator.hasNext()) {Employee employee = (Employee) iterator.next();if (employee.getName().equals(name)) {employee.display();map.remove(employee.getID());System.out.println("请重新输入:"); System.out.println("请输入员工编号:");Scanner scanner1 = new Scanner(System.in);String ID = scanner1.nextLine();System.out.println("请输入员工姓名:");String name1 = scanner1.nextLine();System.out.println("请输入员工职务(普通员工,经理,董事长):");String position = scanner1.nextLine();System.out.println("请输入员工请假天数:");int holiday = scanner1.nextInt();System.out.println("请输入员工基本工资:");double salary = scanner1.nextDouble();switch (position) {case "普通员工":employee = new CommonEmployee(ID, name1, position, holiday, salary);map.put(ID, employee);System.out.println("修改数据成功");employee.display();break;case "经理":employee = new Manager(ID, name1, position, holiday, salary);map.put(ID, employee);System.out.println("修改数据成功");employee.display();break;case "董事长":employee = new Director(ID, name1, position, holiday, salary);map.put(ID, employee);System.out.println("修改数据成功");employee.display();break;default:break;}}else {System.out.println("无此员工");}}MainUI();}/** * 查询员工 */private static void queryEmployee() {Scanner scanner = new Scanner(System.in);System.out.println("请输入员工姓名:");String name = scanner.nextLine();Collection<Employee> values = map.values();Iterator<Employee> iterator = values.iterator();while (iterator.hasNext()) {Employee employee = (Employee) iterator.next();if (employee.getName().equals(name)) {employee.display();MainUI();}else {System.out.println("无此员工");MainUI();}}}}
阅读全文
0 0
- 员工管理系统Map版
- 员工管理系统数组版
- 员工管理系统数组版
- 员工管理系统(集合版)
- 员工管理系统Android版
- 员工管理系统List版
- 员工管理系统数组版-建立员工类
- 员工管理系统数组版-要求
- 员工管理系统集合框架版
- 员工管理系统(数组版)
- 员工考勤管理系统
- 员工管理系统
- 课程设计----员工管理系统
- 员工管理系统(数组)
- 员工管理系统
- 员工管理系统
- 员工管理系统
- 员工管理系统
- Evaluate Reverse Polish Notation问题及解法
- Builder模式设置AlertDialog字体大小、颜色等属性
- Kotlin学习笔记(三)---Kotlin密封类
- Kotlin学习笔记---单例模式
- 本地分支同远程分支关联问题
- 员工管理系统Map版
- Kotlin开发问题(一)
- DrawerLayout中侧边栏NavigationView沉浸式状态栏无效问题
- git 删除已经add但未commit的文件
- 简单明了的分析Android触摸事件,看完再也不纠结了
- ubuntu中自带的ufw防火墙
- 2017 Multi-University Training Contest
- 配置Redis作为缓存
- Java数据结构01----算法概述