import javax.swing.JOptionPane; public class payroll { /** *Brandon Scott *payroll * *This Program * */ public static void main(String[] args) { // user input String sName = JOptionPane.showInputDialog( null, "Enter employee's name: ", "Brandon Scott user input", JOptionPane.QUESTION_MESSAGE); String sNumberOfHours= JOptionPane.showInputDialog( null, "Enter number of hours in a week: ", "Brandon Scott user input", JOptionPane.QUESTION_MESSAGE); String sHourlyPayRate= JOptionPane.showInputDialog( null, "Enter the Hourly Pay Rate: ", "Brandon Scott user input", JOptionPane.QUESTION_MESSAGE); String sFederalWHTaxRate= JOptionPane.showInputDialog( null, "Enter the Federal Tax Withholding Rate: ", "Brandon Scott user input", JOptionPane.QUESTION_MESSAGE); String sStateWHTaxRate=JOptionPane.showInputDialog( null, "Enter the State Tax Withholding Rate: ", "Brandon Scott user input", JOptionPane.QUESTION_MESSAGE); // convert strings into primitives int numberOfHours=Integer.parseInt(sNumberOfHours); double hourlyPayRate=Double.parseDouble(sHourlyPayRate); double federalWHTaxRate=Double.parseDouble(sFederalWHTaxRate); double stateWHTaxRate=Double.parseDouble(sStateWHTaxRate); // calculations double grossPay=numberOfHours * hourlyPayRate; double federalWHTax=grossPay * federalWHTaxRate; double stateWHTax=gossPay * stateWHTaxRate; // concatenate output String output="Employee Name: " + sName; output+="\n\nHours Worked: " + numberOfHours; output+="\nPay Rate: $" + hourlyPayRate; output+="\nGross Pay: $" + grossPay; output+="\nDeductions:"; output+="\nFederal WH ("+ federalWHTaxRate * 100 + "%): $" + federalWHTax; output+="\nState WH ("+ stateWHTaxRate * 100 + "%): $" + stateWHTax; // Display output JOptionPane.showMessageDialog(null, output, "Brandon's Output", JOptionPane.QUESTION_MESSAGE); } }