Write a program that calculates and prints the monthly paycheck fora n employee.
ID: 3613666 • Letter: W
Question
Write a program that calculates and prints the monthly paycheck fora n employee. The net pay is calculated after taking the followingdeductions:Federal IncomeTax: 15%
StateTax: 3.5%
Social SecurityTax: 5.75%
Medicare/Medicaid Tax: 2.75%
PensionPlan: 5%
HealthInsurance: $75.00
Your program should prompt the user to input the gross amount andthe employee name. The output will be stored in a file. Format youroutput to have two decimal places. A sample output follows:
Allison Nields
GrossAmount: $3575.00
FederalTax: $536.25
StateTax: $125.13
Social SecurityTax: $205.56
Medicare/Medicaid Tax: $98.31
PensionPlan: $178.75
HealthInsurance: $75.00
NetPay $2356.00
Explanation / Answer
please rate-thanks import java.io.*; public class untitled { public static void main(String []args)throwsFileNotFoundException {double pay, fed,state,ss,med,pen,health,salary; String name; PrintWriter output=new PrintWriter(new File("outputt.txt")); Scanner in = new Scanner(System.in); 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; output.printf("Gross Amount: $%.2f ", pay); output.printf("Federal Income Tax: $%.2f ",fed); output.printf("State Tax: $%.2f ",state); output.printf("Social Security Tax: $%.2f ",ss); output.printf("Medicare/Medicaid Tax:$%.2f ",med); output.printf("Pension Plan: $%.2f ",pen); output.printf("Health Insurance: $%.2f ",health); output.printf("Net Pay: $%.2f ",salary); output.close();a b } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.