标题:新手遇到JAVA难题了。求帮助。谢谢了
只看楼主
williamsky
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-7-1
 问题点数:0 回复次数:0 
新手遇到JAVA难题了。求帮助。谢谢了

关键如何把不同的区间要求体现出来。同时怎嘛才能把算productivity score的公式 表现出来。谢谢啦
程序代码:
// EmployeeBonus.java - This program calculates an employee's productivity bonus. 

import javax.swing.*;

public class EmployeeBonus 
{
public static void main(String args[])
{
// Declare and initialize variables here.
String employeeName; 
double numTransactions; 
String transactString;
double numShifts; 
String shiftString;
double dollarValue;
String dollarString;
        double score;
double bonus;
final double BONUS_1 = 25.00;
final double BONUS_2 = 50.00;
final double BONUS_3 = 100.00; 
final double BONUS_4 = 200.00;


// This is the work done in the housekeeping() method
                employeeName = JOptionPane.showInputDialog("Enter employee's name: ");
shiftString = JOptionPane.showInputDialog("Enter number of shifts: ");
transactString = JOptionPane.showInputDialog("Enter number of transactions: ");
dollarString = JOptionPane.showInputDialog("Enter transactions dollar value: ");

numShifts = Double.parseDouble(shiftString);
numTransactions = Double.parseDouble(transactString);
dollarValue = Double.parseDouble(dollarString);
// This is the work done in the detailLoop() method
if(score<=30)
bonus=Bonus_1;
else if(score<=79 && score>=31)
bonus=Bonus_2;
else if(score<=199 && score>=80)
bonus=Bonus_3;
else
bonus=Bonus_4
// Write your code here

// This is the work done in the endOfJob() method    
// Output.  
System.out.println("Employee Name: " + employeeName);
System.out.println("Employee Bonus: $" + bonus);

System.exit(0);
}
}     
搜索更多相关主题的帖子: import JAVA 如何 
2015-07-01 11:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-454926-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.240695 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved