import java.util.Scanner;
public class Emplyee {
private String Id;
private String name;
private String dept;
private int yeji;
public static void main(String[] args) {
Emplyee emps[]=new Emplyee[10];
for(int i=0;i<1;i++){
emps[i]=new Emplyee();
System.out.println("请输入员工工号");
Scanner input=new Scanner(System.in);
emps[i].setId(input.next());
System.out.println("请输入员工姓名");
emps[i].setName(input.next());
System.out.println("请输入员工职位");
emps[i].setDept(input.next());
System.out.println("请输入员工业绩");
emps[i].setYeji(input.nextInt());
}
for(int i=0;i<1;i++){
emps[i].sol();
}
}
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 getDept() {
return dept;
}
public void setDept(String dept) {
this.dept = dept;
}
public int getYeji() {
return yeji;
}
public void setYeji(int yeji) {
this.yeji = yeji;
}
public void sol(){
int temp=0;
if(getDept().equals("总经理"))
temp=1;
else if(getDept().equals("销售员"))
temp=2;
else if(getDept().equals("内勤人员"))
temp=3;
else if(getDept().equals("销售经理"))
temp=4;
switch (temp) {
case 1:{
System.out.print(Id);
System.out.print(name);
System.out.print(dept);
System.out.print(yeji);
System.out.println("5000元");
}break;
case 2:{
System.out.print(Id);
System.out.print(name);
System.out.print(dept);
System.out.print(yeji);
System.out.println(yeji*0.05+"元");
}break;
case 3:{
System.out.print(Id);
System.out.print(name);
System.out.print(dept);
System.out.print(yeji);
System.out.println(yeji*100+"元");
}break;
case 4:{
System.out.print(Id);
System.out.print(name);
System.out.print(dept);
System.out.print(yeji);
System.out.println((4000+yeji*0.01)+"元");
}break;
default:
break;
}
}
}
可能会有乱码问题,Run as->run configurations...->common-->console Encoding将编码设置为gbk等