Payroll - // 2.12: Payroll Statement import...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // 2.12: Payroll Statement import java.util.Scanner; public class Payroll { public static void main(String args) { Scanner myScanner = new Scanner (System.in); //Variables String employee; int hours; double hourlyPay, federalTaxRate, stateTaxRate, federalTax, stateTax, grossRate, totalDeduction, netPay; //Input info System.out.print("Please enter employees name: "); employee = myScanner.next(); System.out.print("Enter number of hours worked this week: "); hours = myScanner.nextInt(); System.out.print("Enter hourly pay: "); hourlyPay = myScanner.nextDouble(); System.out.print("Enter the federal tax withholding rate: "); federalTaxRate = myScanner.nextDouble(); System.out.print("Enter the state tax withholding rate: "); stateTaxRate = myScanner.nextDouble(); //Calculation grossRate = hours * hourlyPay; federalTax = grossRate * federalTaxRate; stateTax = grossRate * stateTaxRate; totalDeduction = federalTax + stateTax; netPay = grossRate ‐ totalDeduction; //Output info System.out.println("Employee name: " + employee); System.out.println("Hours Worked: " + hours); System.out.println("Hourly Wage: " + hourlyPay); System.out.println("Federal Tax Withholding Rate " + federalTax); System.out.println("State Tax Withholding Rate " + stateTax); System.out.println("Total Deduction: " + totalDeduction); System.out.println("Net Pay " + netPay); } } ...
View Full Document

This note was uploaded on 07/26/2011 for the course IT 218 taught by Professor Accampo,e during the Spring '11 term at ITT Tech Pittsburgh.

Ask a homework question - tutors are online