Need help with a rudimentary program
I'm sort of new at this so i need help with a few things... I'm making a program to compile wages and i need answers with three things: a.) what are the error messages im getting meaning? b.) How can i calculate the state tax as 2% of my gross pay with the first $200 excluded and c.) how can i calculate the local tax as a flat $10 with $2 deducted for each dependant. any help is appreciated
Here is what i have so far:
public class WagesAsign1
{
public static void main(String[] args)
{
int depend=4;
double hrsWork=40;
double payRate=15;
double grossPay;
grossPay=payRate*hrsWork;
double statePaid;
double stateTax=2.0;
statePaid=grossPay*(stateTax/100);
double localPaid;
double localTax=10.0;
localPaid=grossPay*(localTax/100);
double fedPaid;
double fedTax=10.0;
double taxIncome;
fedPaid=taxIncome*(fedTax/100);
taxIncome=grossPay-(statePaid+localPaid);
double takeHome;
System.out.println("Assignment 1 Matt Foraker\n");
System.out.println("Hours worked="+hrsWork+" Pay rate $"+payRate+" per/hour dependants: "+depend);
System.out.println("Gross Pay $"+grossPay+"\nState tax paid $"+statePaid+"\nLocal tax paid $"+localPaid+"\nFederal tax paid $"+fedPaid);
System.out.println("You take home a total of $"+takeHome);
}
}
and these are the error messages so far:
WagesAsign1.java:23: variable taxIncome might not have been initialized
fedPaid=taxIncome*(fedTax/100);
^
WagesAsign1.java:29: variable takeHome might not have been initialized
System.out.println("You take home a total of $"+takeHome);
^

