So im trying to do a school project and im running into problem and im just really confused so im asking ehre Im really new and I'm not exactly sure if what im doing is correct or not but its saying that the variable compensation and SSS is not initialized why is that? and what should I do to fix? again im new so I might be doing something stupid probably not doing the if statements correctly?
import java.util.Scanner;
public class Netpay
{
public static void main(String args[])
{
Scanner scanner = new Scanner(System.in);
double Gross,SSS,Tax,Philhealth,TotalDeduction,taxableincome,compensation,percentage,Netpay;
int pagibig = 50;
System.out.println("Please enter the gross basic pay of the employee:" );
Gross = scanner.nextDouble();
Philhealth = Gross*0.02;
if (Gross <= 4249.0)
SSS = 180.0/2.0;
if (Gross >= 4250.0 && Gross <= 4749.99)
SSS = 202.5/2.0;
if (Gross >= 4750.0 && Gross <= 5249.99)
SSS = 225.0;
if (Gross >= 5250.0 && Gross <= 5749.99)
SSS = 247.5/2.0;
if (Gross >= 5750.0 && Gross <= 6249.99f)
SSS = 270.0/2.0;
if (Gross >= 6250.0 && Gross <= 6749.99f)
SSS = 292.5/2.0;
if (Gross >= 6750.0 && Gross <= 7249.99f)
SSS = 315.0/2.0;
if (Gross >= 7250.0 && Gross <= 7749.99)
SSS = 337.5/2.0;
if (Gross >= 7750.0 && Gross <= 8249.99)
SSS = 360.0/2.0;
if (Gross >= 8250.0 && Gross <= 8749.99)
SSS = 382.5/2.0;
if (Gross >= 8750.0 && Gross <= 9249.99)
SSS = 405.0/2.0;
if (Gross >= 9250.0 && Gross <= 9749.99)
SSS = 427.5/2.0;
if (Gross >= 9750.0 && Gross <= 10429.99)
SSS = 450.0/2.0;
if (Gross >= 10250.0 && Gross <= 10749.99)
SSS = 472.5/2.0;
if (Gross >= 10750.0 && Gross <= 11249.99)
SSS = 495.0/2.0;
if (Gross >= 11250.0 && Gross <= 11749.99)
SSS = 517.5/2.0;
if (Gross >= 11750.0 && Gross <= 12249.99)
SSS = 540.0/2.0;
if (Gross >= 12250.0 && Gross <= 12749.99)
SSS = 562.5/2.0;
if (Gross >= 12750.0 && Gross <= 13249.99)
SSS = 585.0/2.0;
if (Gross >= 13250.0 && Gross <= 13749.99)
SSS = 607.5/2.0;
if (Gross >= 13750.0 && Gross <= 14249.99)
SSS = 630.0/2.0;
if (Gross >= 14250.0 && Gross <= 14749.99)
SSS = 652.5/2.0;
if (Gross >= 14750.0 && Gross <= 15249.99)
SSS = 675.0/2.0;
if (Gross >= 15250.0 && Gross <= 15749.99)
SSS = 697.5/2.0;
if (Gross >= 15750.0 && Gross <= 16249.99)
SSS = 720.0/2.0;
if (Gross >= 16250.0 && Gross <= 16749.99)
SSS = 742.5/2.0;
if (Gross >= 16750.0 && Gross <= 17249.99)
SSS = 765.0/2.0;
if (Gross >= 17250.0 && Gross <= 17749.99)
SSS = 787.5/2.0;
if (Gross >= 17750.0 && Gross <= 18249.99)
SSS = 810.0/2.0;
if (Gross >= 18250.0 && Gross <= 18749.99)
SSS = 832.5/2.0;
if (Gross >= 18750.0 && Gross <= 19249.99)
SSS = 855.0/2.0;
if (Gross >= 19250.0 && Gross <= 19749.99)
SSS = 877.5/2.0;
if (Gross >= 19750.0 && Gross <= 20249.99)
SSS = 900.0/2.0;
if (Gross >= 20250.0 && Gross <= 20749.99)
SSS = 900.0/2.0;
if (Gross >= 20750.0 && Gross <= 21249.99)
SSS = 900.0/2.0;
if (Gross >= 21250.0 && Gross <= 21749.99)
SSS = 900.0/2.0;
if (Gross >= 21750.0 && Gross <= 22249.99)
SSS = 900.0/2.0;
if (Gross >= 22250.0 && Gross <= 22749.99)
SSS = 900.0/2.0;
if (Gross >= 22750.0 && Gross <= 23249.99)
SSS = 900.0/2.0;
if (Gross >= 23250.0 && Gross <= 23749.99)
SSS = 900.0/2.0;
if (Gross >= 23750.0 && Gross <= 24249.99)
SSS = 900.0/2.0;
if (Gross >= 24250.0 && Gross <= 24749.99)
SSS = 900.0/2.0;
if (Gross >= 24750.0 && Gross <= 25249.99)
SSS = 900.0/2.0;
if (Gross >= 25250.0 && Gross <= 25749.99)
SSS = 900.0/2.0;
if (Gross >= 25750.0 && Gross <= 26249.99)
SSS = 900.0/2.0;
if (Gross >= 26250.0 && Gross <= 26749.99)
SSS = 900.0/2.0;
if (Gross >= 26750.0 && Gross <= 27249.99)
SSS = 900.0/2.0;
if (Gross >= 27250.0 && Gross <= 28249.99)
SSS = 900.0/2.0;
if (Gross >= 28250.0 && Gross <= 28749.99)
SSS = 900.0/2.0;
if (Gross >= 28750.0 && Gross <= 29249.99)
SSS = 900.0/2.0;
if (Gross >= 29250.0 && Gross <= 29749.99)
SSS = 900.0/2.0;
if (Gross >= 29750.0)
SSS = 900.0/2.0;
if (Gross <= 10417.0)
compensation = 0.0;
percentage = 0.0;
if (Gross > 10417.0 && Gross <=16666.0)
compensation = 10417.0;
percentage = 0.2;
if (Gross >=16667.0 && Gross <=33332.0)
compensation = 16667.0;
percentage = 0.25;
if (Gross >= 33333.0 && Gross <=83332.0)
compensation = 33333.0;
percentage = 0.3;
if (Gross > 83333.0 && Gross <=333332.0)
compensation = 83333.0;
percentage = 0.32;
if (Gross >= 333333.0)
compensation = 333333.0;
percentage = 0.35;
taxableincome = pagibig + Philhealth + SSS;
Tax = (taxableincome - compensation)*percentage;
TotalDeduction = Tax + taxableincome;
Netpay = Gross - TotalDeduction;
System.out.println("Your Employees Netpay is:" + Netpay);
}
}