I need to write a java program in Eclipse Indigo that calculates and prints the
ID: 3629794 • Letter: I
Question
I need to write a java program in Eclipse Indigo that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions:FEDERAL INCOME TAX: 15%
STATE TAX: 3.5%
SOCIAL SECURITY TAX: 5.75%
MEDICARE/MEDICAID TAX: 2.75%
PENSION PLAN: 5%
HEALTH INSURANCE: $75.00
The program should prompt the user to input the gross amount and the employee name. The output will be stored in a file. Format the output to have two decimal places. A sample output follows:
Bill Robinson
Gross Amount: $ 3575.00
FEDERAL INCOME TAX: $ 536.25
STATE TAX: $ 125.13
SOCIAL SECURITY TAX: $ 205.56
MEDICARE/MEDICAID TAX: $ 98.31
PENSION PLAN: $ 178.75
HEALTH INSURANCE: $ 75.00
NET PAY: $ 2356.00
Explanation / Answer
please rate - thanks
import java.util.*;
import java.io.*;
public class FileOut
{
public static void main(String[] args)throws IOException
{PrintWriter f=new PrintWriter(new FileWriter("output.txt"));
double pay, fed,state,ss,med,pen,health,salary;
Scanner in=new Scanner(System.in);
String name;
System.out.print("What is the Employees name? ");
name=in.nextLine();
System.out.print("What is the Employees gross pay? ");
pay=in.nextDouble();
fed=pay*.15;
state=pay*.035;
ss=pay*.0575;
med=pay*.0275;
pen=pay*.05;
health=75;
salary=pay-fed-state-ss-med-pen-health;
f.println(name);
f.printf("GrossAmount: $%.2f%n",pay);
f.printf("FederalIncome Tax: $%.2f%n",fed);
f.printf("StateTax: $%.2f%n",state);
f.printf("SocialSecurity Tax: $%.2f%n",ss);
f.printf("Medicare/MedicaidTax: $%.2f%n",med);
f.printf("PensionPlan: $%.2f%n",pen);
f.printf("HealthInsurance: $%.2f%n",health);
f.printf("NetPay: $%.2f%n",salary);
f.close();
}
}