[/quote][/HTML]How do I get the variable "nPay" to give me a result?
[quote]
import java.util.Scanner;
public class WeeklyPay1
{
public static void main(String[] a)
{
String name; //Employee's name
String input; //Holds additional kb info
char married; //Married? y or n
char health; //Healthcare? y or n
double hours; //Hours worked by employee
double gPay; //Gross pay
double nDep; //Number of Dependents
double TaxPay; //Income that is taxable
double Taxes; //Holds tax rate for taxable pay
final double marDed= 150; //Standard Deductions for married
final double sDed = 75; //Standard Deductions for single
final double mMed=100; //Medical deductions for married
final double sMed=60; //Medical deductions for single
double nPay; //Employees Net Pay
Payroll1 getpaid = new Payroll1();
Scanner kb = new Scanner(System.in);
//Get the Employee's marital status
System.out.print("Are you Married? Y or N: ");
input = kb.nextLine();
married = input.charAt(0);
//Do you have Healthcare?
System.out.print("Do you have Healthcare: Y or N: ");
input = kb.nextLine();
health = input.charAt(0);
//Get Employee's name
System.out.print("Enter your name: ");
name = kb.nextLine();
//Get Employee's Pay Rate
System.out.print("Enter pay rate: ");
rate = kb.nextDouble();
//Get Employee's hours worked
System.out.print("Enter the number of hours you worked: ");
hours = kb.nextDouble();
//Get Employee's dependents
System.out.print("How many dependents do you have: ");
nDep = kb.nextDouble();
//Store the data
getpaid.setPayRate(rate);
getpaid.setHrsWorked(hours);
getpaid.setDependents(nDep);
//Determine if married, and determine tax bracket
if(married == 'Y' || married == 'y')
{
//Calculate taxable pay
TaxPay = getpaid.getGrossPay()- marDed - (70 * getpaid.getDependents());
if (health == 'Y' || health == 'y')
TaxPay = TaxPay - 100;
if(TaxPay > 800)
Taxes = (TaxPay - 800) * .35 + (800 - 500) * .25 + (500 - 200) * .15 + 200 * .10;
else if (TaxPay > 500)
Taxes = (TaxPay -500) * .25 + (500-200) * .15 + 200 * .10;
else if (TaxPay > 200)
Taxes = (TaxPay -200) * .15 + 200 * .10;
else
Taxes = (TaxPay * .10);
}
else
{
TaxPay = getpaid.getGrossPay() - sDed - (70 * getpaid.getDependents());
if(health == 'N' || health == 'n')
TaxPay -= 60;
if (TaxPay > 400)
Taxes = (TaxPay - 400) * .35 + (400 - 250) * .25 + (250 -100) * .15 + 100*.10;
else if (TaxPay > 250)
Taxes = (TaxPay - 250) * .25 + (250 - 100) * .15 + 100 * .10;
else if (TaxPay > 100)
Taxes = (TaxPay - 100) * .15 + 100 * .10;
else
Taxes = TaxPay * .10;
}
nPay = getpaid.getGrossPay() - mMed; // - Taxes;
System.out.println("Net Pay " + nPay);
}
}
}
}