package learn;
import java.util.*;
import java.io.*;
public class Tyg {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
EnMan en=new EnMan();
BufferedReader re=new BufferedReader (new InputStreamReader(System.in));
while(true){
System.out.println("请选择你要进行的操作:");
System.out.println("1:表示添加一个雇员");
System.out.println("2: 表示显示一个雇员");
System.out.println("3:表示修改一个雇员");
System.out.println("4:表示删除一个雇员");
System.out.print("5:表示退出系统");
String operaType=re.readLine();
if(operaType.equals("1")){
System.out.println("雇员的名字为:");
String name=re.readLine();
System.out.println("雇员的编号为:");
String no=re.readLine();
System.out.println("雇员的薪水为:");
float sal=Float.parseFloat(re.readLine());
Emg em=new Emg(name,no,sal);
en.addE(em);
}
else if(operaType.equals("2")){
System.out.println("请输入编号:");
String no=re.readLine();
en.showInfo(no);
}
else if(operaType.equals("3")){
System.out.println("请输入编号:");
String no=re.readLine();
System.out.println("请输入薪水:");
float newsal=Float.parseFloat(re.readLine());
en.changeE(no, newsal);
}
else if(operaType.equals("4")){
System.out.print("请输入编号:");
String no=re.readLine();
en.delE(no);
}
else if(operaType.equals("5")){
System.exit(0);
}
}
}
}
class Emg
{
private String name;
private String no;
private float sal;
public Emg(String name,String no,Float sal)
{this.name=name;
this.no=no;
this.sal=sal;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public float getSal() {
return sal;
}
public void setSal(float sal) {
this.sal = sal;
}
}
class EnMan
{
private ArrayList al=null;
public void EnMan(){
al=new ArrayList();
}
public void addE(Emg e1){
al.add(e1);
}
public void showInfo(String no){
for(int i=0;i<al.size();i++ )
{ Emg e2=(Emg)al.get(i);
if(e2.getNo().equals(no)){
System.out.println("该员工的信息是:");
System.out.println("该员工的编号是"+no);
System.out.println("该员工的工资是"+e2.getSal());