62,628
社区成员
发帖
与我相关
我的任务
分享
import java.util.Scanner;
class Employee
{
private String num;
private String name;
private int age;
private String job;
private String bumen;
private int b;
public Employee(String c_num,String c_name,int c_age,String c_job,String c_bumen,int a){
num=c_num;
name=c_name;
age=c_age;
job=c_job;
bumen=c_bumen;
b=a;
}
public void Count(){
int cnum=0;
if(b!=1)
cnum++;
System.out.println("出勤人数:"+cnum);
}
public void print(){
System.out.println(num+' '+name+' '+age+' '+job+' '+bumen);
}
}
public class T3_2{
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
Employee e1=new Employee("001","陈杰",25,"销售","销售部",in.nextInt());
e1.print();
Employee e2=new Employee("002","张三",22,"销售","销售部",in.nextInt());
e2.print();
Employee e3=new Employee("003","李四",26,"销售","销售部",in.nextInt());
e3.print();
Employee e4=new Employee("004","王五",28,"销售","销售部",in.nextInt());
e4.print();
Employee e5=new Employee("005","苏语",21,"销售","销售部",in.nextInt());
e5.print();
}
}

