标题:请各位大神帮忙看看哪里出错了,表示新手有点笨哈~
只看楼主
番茄炒鸡蛋
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2014-3-13
结帖率:100%
已结贴  问题点数:20 回复次数:3 
请各位大神帮忙看看哪里出错了,表示新手有点笨哈~
import javax.swing.JOptionPane;
  public class informations{
    public static void main(String[] args){
          String nameofEmployeeString=JOptionPane.showInputDialog(
        "Enter employee's name:");
        String hoursWorkedString=JOptionPane.showInputDialog(
        "Enter number of hours worked in a week:");
        double hoursWorked=Double.parseDouble(hoursWorkedString);
        String hourlyPayRateString=JOptionPane.showInputDialog(
        "Enter hourly pay rate:");
        double hourlyPayRate=Double.parseDouble(hourlyPayRateString);
        String federalTaxWithholdingRateString=JOptionPane.showInputDialog(
        "Enter federal tax withholding rate:");
        double federalTaxWithholdingRate=Double.parseDouble(federalTaxWithholdingRateString);
        String stateTaxWithholdingRateString=JOptionPane.showInputDialog(
        "Enter state tax withholding rate:");
        double stateTaxWithholdingRate=Double.parseDouble(stateTaxWithholdingRateString);
        double grossPay=hourlyPayRate*hoursWorked;
        double federalWithholding=grossPay*federalTaxWithholdingRate;
        double stateWithholding=grossPay*stateTaxWithholdingRate;
        double totalDeduction=federalWithholding+stateWithholding;
        double netPay=grossPay - totalDeduction;
        String output="Employee's Name:" + nameofEmployee+"\n"+
                      "Hours Worked:"+hoursWorked+"\n"+
                      "Pay Rate:$"+hourlyPayRate+"\n"+
                      "Gross Pay:$"+grossPay+"\n"+
                      "Deductions:\n"+
                      "\t Federal Withholding(" + federalTaxWithholdingRate+"%):$"+federalWithholding+"\n"+
                      "\t State Withholding(" + stateTaxWithholdingRate+"%):$"+stateWithholding+"\n"+
                      "\t Total Deduction:$"+totalDeduction+"\n"+
                      "Net Pay:$" + netPay;
         JOptionPane.showMessageDialog(null,output);
  }
}
搜索更多相关主题的帖子: employee public double number import 
2014-03-13 17:09
番茄炒鸡蛋
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2014-3-13
得分:0 
但是一执行就是这样的
2014-03-13 17:09
番茄炒鸡蛋
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2014-3-13
得分:0 
哎呀,电脑上图也不行,就是说那个nameofEmployee那里出问题了  找不到符号
2014-03-13 17:13
hhwz
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:87
帖 子:687
专家分:4502
注 册:2011-5-22
得分:14 
swing 无能为力
2014-03-13 17:24



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




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

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