职员薪水管理系统需求如下:
/*** author:kevin* date:20110-7-15* function:use ArrayList to build a system of EmployeeSalaryMangement ,* the system is useful for manager to add new employee'information,delete employee'information,* update employee'information,and show employee'information.* it's easy to obtain the OOP.* */import java.util.ArrayList;import java.io.*;
public class EmployeeSalary {
public static void main(String[] args) throws Exception{
//create object EmpManageEmpManage empm = new EmpManage();InputStreamReader isr = new InputStreamReader(System.in);BufferedReader br = new BufferedReader(isr);//create a menuwhile(true){System.out.println("select what you want to do");System.out.println("select 1:insert new employee");System.out.println("select 2:show information");System.out.println("select 3:delete employee");System.out.println("select 4:update salary");System.out.println("select 5:excit");String oper= br.readLine();if (oper.equals("1")){System.out.println("input number:");String empNo = br.readLine();System.out.println("input name:");String empName = br.readLine();System.out.println("input salary:");float salary=Float.parseFloat(br.readLine());Emp emp = new Emp(empNo,empName,salary);empm.addEmp(emp);}else if (oper.equals("2")){System.out.println("input number:");String empNo = br.readLine();empm.showEmp(empNo);}else if (oper.equals("3")){System.out.println("input number:");String empNo = br.readLine();empm.delEmp(empNo);}else if (oper.equals("4")){System.out.println("input number:");String empNo = br.readLine();System.out.println("input new salary:");float newSalary =Float.parseFloat(br.readLine()) ;empm.updateEmp(empNo, newSalary);}else if (oper.equals("5")){//exit system.System.exit(0);}}
}
}
//*****************************************************************
//class Employeeclass Emp{private String empNo; //employee numberprivate String empName; //employee nameprivate float salary; //employee salarypublic String getEmpNo() {return empNo;}public void setEmpNo(String empNo) {this.empNo = empNo;}public String getEmpName() {return empName;}public void setEmpName(String empName) {this.empName = empName;}public float getSalary() {return salary;}public void setSalary(float salary) {this.salary = salary;}
public Emp(String empNo,String empName,float salary){this.empNo = empNo;this.empName = empName;this.salary = salary;}
}
//**********************************************************
//class EmployeeSalaryManage
class EmpManage{private ArrayList al = null;public EmpManage(){al = new ArrayList();}//insert new employeepublic void addEmp(Emp emp){al.add(emp);}//show informationpublic void showEmp(String empNo){for (int i= 0 ;i
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?