阅读以下说明和Java代码,填补Java代码中的空缺,将解答写在对应栏内。
[说明]
己知某公司按周给员工发放工资,其工资系统需记录每名员工的员工号、姓名、工资等信息。其中一些员工是正式的,按年薪分周发放(每年按52周计算);另一些员工是计时工,以小时工资为基准,按每周工作小时数核算发放。
下面是实现该工资系统的Java代码,其中定义了四个类:工资系统类PayRoll,员工类Employee,正式工类Salaried和计时工类Hourly,Salaried和Hourly是Employee的子类。
[Java代码]
abstract class Employee
protected String name; //员工姓名
protected int empCode; //员工号
protected double salary; //周发放工资
publ ic Employee(int empCode,String name)
this.empCode=empCode;
this.name=name;
public double getSalary( )
return this.salary;
public abstract void pay( );
class Salaried ______ Employee
private double annualSalary;
Salaried(int empCode,String name,double payRate)
super(empCode,name);
this.annualSalary=payRate;
public void pay( )
salary=______;//计算正式员工的周发放工资数
System.out.printin(this.name+":"+this.salary);
class Hourly ______ Empioyee
private double hourlyPayRate;
private int hours;
Hourly(int empCode,String name,int hours,double payRate)
super(empCode,name);
this.hourlyPayRate=payRate;
this.hows=hours,
public void pay( )
salary=______;//计算计时工的周发放工资数
System.out.printin(this.name+":"+this.salary);
public class PayRoll
private ______ employees[]=
new Salaried(1001,"Zhang San",58000.00),
//此处省略对其他职工对象的生成
new Hourly(1005,"Li",12,50.00)
;
public void pay(Employee e[])
for(int i=0;i<e.length;i++)
e[i].pay( );
public static void main(String[]rgs)
PayRoll payRoll=new PayRoll( );
payRoll.pay(______);
double total=0.0;
for(int i=0;i<payRoll.employees.length;i++)//统计周发放工资总额
total+=payRoll.employees[i].getSalary( );
System.out.printin(total);
题库:初级程序员
类型:填空题
时间:2017-07-03 11:59:33
免费下载:《填空集》Word试卷
阅读以下说明和Java代码,填补Java代码中的空缺,将解答写在对应栏内。
[说明]
己知某公司按周给员工发放工资,其工资系统需记录每名员工的员工号、姓名、工资等信息。其中一些员工是正式的,按年薪分周发放(每年按52周计算);另一些员工是计时工,以小时工资为基准,按每周工作小时数核算发放。
下面是实现该工资系统的Java代码,其中定义了四个类:工资系统类PayRoll,员工类Employee,正式工类Salaried和计时工类Hourly,Salaried和Hourly是Employee的子类。
[Java代码]
abstract class Employee
protected String name; //员工姓名
protected int empCode; //员工号
protected double salary; //周发放工资
publ ic Employee(int empCode,String name)
this.empCode=empCode;
this.name=name;
public double getSalary( )
return this.salary;
public abstract void pay( );
class Salaried ______ Employee
private double annualSalary;
Salaried(int empCode,String name,double payRate)
super(empCode,name);
this.annualSalary=payRate;
public void pay( )
salary=______;//计算正式员工的周发放工资数
System.out.printin(this.name+":"+this.salary);
class Hourly ______ Empioyee
private double hourlyPayRate;
private int hours;
Hourly(int empCode,String name,int hours,double payRate)
super(empCode,name);
this.hourlyPayRate=payRate;
this.hows=hours,
public void pay( )
salary=______;//计算计时工的周发放工资数
System.out.printin(this.name+":"+this.salary);
public class PayRoll
private ______ employees[]=
new Salaried(1001,"Zhang San",58000.00),
//此处省略对其他职工对象的生成
new Hourly(1005,"Li",12,50.00)
;
public void pay(Employee e[])
for(int i=0;i<e.length;i++)
e[i].pay( );
public static void main(String[]rgs)
PayRoll payRoll=new PayRoll( );
payRoll.pay(______);
double total=0.0;
for(int i=0;i<payRoll.employees.length;i++)//统计周发放工资总额
total+=payRoll.employees[i].getSalary( );
System.out.printin(total);
本题关键词:工程说明,说明,明代,说明书,中药说明书,错误说明,警示说明,说明义务,中文警示说明,工程清单总说明;