Write a Java program that takes the gross pay for an employee ,calculates and pr
ID: 3793589 • Letter: W
Question
Write a Java program that takes the gross pay for an employee ,calculates and prints the net pay and hence the monthly paychecks . Code must be written in Java code!
DA1 D Thu 1:26 PM E Chrome File Edit View History Bookmarks People Window Help O Course Conte 201701 WO X C Chegg study Guided Sol x dganic 2323 C Secure https://fairfield.blackboard.com/webapps/blackboard/content/listContent.jsp?course id- 97803 1&content; da-597625-18mode reset Ar Ka Apps D VVL. M ch 5 operational A M Exam 2 review (Ch... Shion employee is Low MIDDLE" or "HIGH" If the income is less than 40k,then the employee is in the low income category. If the income is more than 40k and less than 80k then the employee is in the middle income category. rfield If the income is more than 80k,then the employee is in the high income category. sity 2014 Display the above details using JOptionPane in the following format: Gross Amount: b R2014 Federal Income tax ac164 State Tax Social Security Tax r des d Tax Pention plan Health Insurance on Manu Net Pay decisi INCOME LEVEL rcuits ctions Medtro Display the employee's name as the title of the message boxExplanation / Answer
import java.util.*;
import java.io.*;
class Employee{
public static void main(String[] args){
System.out.print("Enter your Gross Pay :- ");
//Enter your Gross Pay here
Scanner sc = new Scanner(System.in);
double grossPay = sc.nextDouble();
//Creating EmployeeHelper object
EmployeeHelper helper = new EmployeeHelper();
//Calling the calculateNetPay function passing the grossPay as parameter to calculate the netPay
double netIncome = helper.calculateNetPay(grossPay);
//print Income Level by checking the neIncome Range
if(netIncome < 40000){
System.out.println("LOW");
}
else if(netIncome > 40000 && netIncome < 80000){
System.out.println("MIDDLE");
}
else System.out.println("HIGH");
}
}
//Helper class
class EmployeeHelper{
//Method inside the HelperClass
public double calculateNetPay(double grossPay){
//Federal Income tax given 15%
double federalIncomeTax = grossPay*0.15;
//State Tax tax given 3.5%
double stateTax = grossPay*0.035;
//Social Security Tax given 5.75%
double socialSecurityTax = grossPay*0.0575;
//Medicare Tax given 2.75%
double medicareTax = grossPay*0.0275;
//Pension Plan given 5%
double pensionPlan = grossPay*0.05;
//Health Insurance given $75
double healthInsurance = 75;
//netPay is calculated by removing the above mentioned taxes
double netPay = grossPay - (federalIncomeTax + stateTax + socialSecurityTax + medicareTax + pensionPlan + healthInsurance);
return netPay;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.