0

An hourly employee is paid at a rate of 125 per hour,from the workers gross pay,12% withheld for income tax,and 15 withheld for union dues. If the worker has 2 of more dependents additional 120 for health insurance. Write a java program that will input the total deduction,basic salary,gross pay and net pay.
Additional Deduction:
Civil Status SSS Insurance
Single 9% of grosspay
Married 6% of grosspay
Head of the family 8% of grosspay


as of now,here i have done. but it has an error. pls help me!

import javax.swing.*;
class totalDeduction{
public static void main(String[]args){
	String w,stat,dpen,t;
	int cstat,hw,ud;
	double gpay,npay,td,tax,dp,sss,siS,siM,sD,siH;
	w=JOptionPane.showInputDialog(new JFrame(),"Enter Hours Worked:");
	hw=Integer.parseInt(w);
	td=(ud+tax);
	JOptionPane.showMessageDialog(null,"Your Total Deduction is "+ td);
	gpay=hw*125;
	ud=15;
	JOptionPane.showMessageDialog(null,"Your Gross Pay is "+ gpay);
	tax=(gpay*.12);
	JOptionPane.showMessageDialog(null,"Your Tax is "+ tax);
	siS=gpay*.09;
	siM=gpay*.06;
	siH=gpay*.08;
	stat=JOptionPane.showInputDialog(new JFrame(),"Enter Civil Status: \nchoose \n[1]SINGLE \n[2]MARRIED \n[3]HEAD OF THE FAMILY");
	cstat=Integer.parseInt(stat);
	dpen=JOptionPane.showInputDialog(new JFrame(),"How many dependents?");
	dp=Double.parseDouble(dpen);
	if (dp>=2){
	gpay=(siM+120);
	if (cstat==1){
		JOptionPane.showMessageDialog(null,"Your Gross Pay is " +siS);
	}else if (cstat==2){
		JOptionPane.showMessageDialog(null,"Your Gross Pay is " +siM);
	}else if (cstat==3){
		JOptionPane.showMessageDialog(null,"Your Gross Pay is " +siH);
		
		System.exit(0);
		}
		}
	}
}

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by NormR1
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.