题目内容

阅读以下说明和Java代码,将填入 (n) 处的字句在对应栏内。
[说明]
现需要统计某企业员工的月平均工资,即该企业本月发给员工的工资总和除以员工人数。假设企业本月发给员工的工资总和为sumSalary,该企业的员工总数为employeeNumber,下面的程序代码计算该企业员工本月的平均工资,其中需要处理employNumber为0的情况。
[Java代码]
import Java.util.Scanner;
public class JavaMain{
static float average(float X,int Y)throws Exception{
if(Y==0)throw new Exception((1)______ );
return X/Y;
}
Static Void caculate()throws Exception{
float sumSalary;
int employeeNumber;
Scanner SC=new Scanner((2)______);
try{
System.out.println("请输入当月工资总和与员工数:");
sumSalary=sc.nextFloat(); //从标准输入获得工资总和
employeeNumber=SC.nextInt(); //从标准输入获得员工数
float k=average(sumSalary,employeeNumber);
System.out.println("平均工资:"+k);
}
(3)______ (Exception e){
if(e.getMeSSage().equalSIgnoreCase("zero")){
System.out.println("请重新输入当月工资总和与员工数:");
sumSalary=sc.nextFloat();
employeeNumber=sc.nextInt();
float k=average(sumSalary,employeeNumber);
System.out.println("平均工资:"+k);
}
}
}
public Static void msin(String[] argS){
try {
caculate();
}
(4)______ (Exception e) {
if (e.getMessage().equalsIgnoreCase("zero"))
system.out.println("程序未正确计算平均工资!");
}
}
}
[问题1]
程序运行时,若输入的员工工资总和为6000,员工数为5,则屏幕输出为:
请输入当月工资总和与员工数:
6000 5
(5)______
[问题2]
若程序运行时,第一次输入的员工工资总和为6000,员工数为0,第二次输入的员工工资总和为0,员工数为0,则屏幕输出为:
请输入当月工资总和与员工数:
6000 0
(6)______
0 0
(7)______

查看答案
更多问题

资生堂是如何进行市场细分的,在进行市场细分时,需要考虑哪些因素?

On the left are some shapes and codes that go with them. You must decide how the code letters go with the shapes. Which codes should replace the question mark on the right?

胸廓扩张度、语音震颤、胸膜摩擦感

结合上述材料,指出为什么党在不同历史时期都十分重视统一战线问题?

答案查题题库