码迷,mamicode.com
首页 > 其他好文 > 详细

算工资

时间:2014-08-06 18:47:51      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   java   os   io   ar   cti   

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

算工资

标签:style   blog   color   java   os   io   ar   cti   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!