这样写对吗?怎么把cnum输出啊

qq_35983245 2017-03-16 06:50:05

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();
}
}



求大佬指教!!!!
...全文
141 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq_37936576 2017-03-16
  • 打赏
  • 举报
回复
qq_35983245 2017-03-16
  • 打赏
  • 举报
回复

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧