首页 > 代码库 > 算工资
算工资
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))); }}
输入员工姓名,每周工作时间,每小时工资,联邦所得税税率,州所得税税率。输出员工工资单。
员工工资等于每周时间*每小时就工资-联邦交的税-州交的税。
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。