皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
试题六 (共15 分) 阅读以下说明和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 main(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)
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】动作电位产生之后达到峰值,开始复极化直到恢复静息电位,其中复极化产生的最主要的原因是()
A.
钠通道失活,电压门控钾通道大量开放
B.
氯离子不断内流
C.
时间的延长信号不断衰减
D.
钠钾泵不断工作
【多选题】酒店战略管理基本内容包括:
A.
外部环境分析,研判企业机遇和挑战
B.
内部条件分析,识别企业优势和劣势,确定企业目标使命
C.
选择业务及战略模式,培育竞争优势
D.
实施和评估
【简答题】阅读理解。 Some researchers claim that people's personalities can be classified by their blood types. If you have blood type O, you are a leader. When you see something you want, you strive to achieve your...
【判断题】Please buy the ticket from the ticket vendingmachine. 译:请到服务中心买票。
A.
正确
B.
错误
【多选题】酒店战略管理的三个基本使命表现为
A.
实现超越发展
B.
构建竞争优势
C.
保证持续增长
D.
灵活处理危机
【简答题】Some researchers claim that people’s personalities can be classified by their blood types If you have blood type O, you are a leader. When you see something you want , you strive to achieve your goal....
【简答题】Some researchers claim that people´s personalities can be classified by their blood types.If you have blood type O, you are a leader. When you see something you want, you strive to achieve your goal....
【简答题】Dreaming is believing, claim researchers of a new study, who found that dreams have an effect on people’s behavior, judgment and they might contain important hidden truths as well. “Psychologists’ exp...
【单选题】Researchers claim to have found the first proof _______ getting a regular eight hours a night really does make you appear healthier and more attractive.
A.
as
B.
that
C.
how
D.
which
【简答题】简述酒店战略管理的基本使命及其主要内容
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题