首页 > 其他 > 详细

算工资

时间:2014-08-06 18:47:51      阅读:305      评论:0      收藏:0      [点我收藏+]
import javax.swing.JOptionPane;
public class Salary {
    public static void main(String[] args){
        String name = JOptionPane.showInputDialog(null,"请输入姓名:");
        String input = JOptionPane.showInputDialog(null,"请输入每周工作时间:");
        String input1 = JOptionPane.showInputDialog(null,"请输入每小时工资:");
        String input2 = JOptionPane.showInputDialog(null,"请输入联邦所得税税率:");
        String input3 = JOptionPane.showInputDialog(null,"请输入州所得税税率:");
        double hours = Double.parseDouble(input);
        double rate = Double.parseDouble(input1);
        double federal = Double.parseDouble(input2);
        double state = Double.parseDouble(input3);
        System.out.println("Employee Name:" + name);
        System.out.println("Hours Worked:" + hours);
        System.out.println("Pay Rate:" + hours);
        System.out.println("Gross Pay:" + hours * rate);
        System.out.println("Deductions:");
        System.out.println("Federal Withholding:" + hours * rate * federal);
        System.out.println("State Witholding:" + hours * rate * state);
        System.out.println("Total Deduction:" + (hours * rate * federal + hours * rate * state));
        System.out.println("Net Pay:" + (hours * rate - (hours * rate * federal + hours * rate * state)));
    }

}

输入员工姓名,每周工作时间,每小时工资,联邦所得税税率,州所得税税率。输出员工工资单。

员工工资等于每周时间*每小时就工资-联邦交的税-州交的税。

算工资,布布扣,bubuko.com

算工资

原文:http://www.cnblogs.com/Amoxicil/p/3894994.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!