-
February 26th, 2013, 02:05 PM
#1
Quick advise on Payroll programm
Code:
import java.util.Scanner;
public class Payroll {
public static void main(String[] args) {
String name;
double payRate, hoursWorked, fedTax, stateTax, grossPay, netPay, totalDeduction;
Scanner input = new Scanner(System.in);
System.out.println("Employee\'s name: ");
name = input.next();
System.out.println("Number of hours worked: ");
hoursWorked = input.nextDouble();
System.out.println("Hourly pay rate (e.g., 6.75)");
payRate = input.nextDouble();
grossPay = payRate * hoursWorked;
System.out.println("Gross Pay: " + grossPay);
System.out.println("Deductions:");
System.out.print("\t Federal Withholding: ");
fedTax = input.nextDouble();
double fedTaxr = grossPay-(grossPay-fedTax/100);
System.out.println("\t State Withholding ");
stateTax = input.nextDouble();
double stateTaxr = grossPay-(grossPay*stateTax/100);
totalDeduction = fedTaxr + stateTaxr;
System.out.println("\t Total dedduction: " + totalDeduction);
netPay = grossPay - totalDeduction;
System.out.println("Net Pay: " + netPay);
}
}
The above is a code that I wrote please pinpoint to any issues you may see, followed by , perhaps, advise on how to eliminate the problem. Please do not re-write the code, just an expert advise will do!
Thank you!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|