In my code I need to print out the "tax" variable. It's not working and I think I know why I just don't know how to do it. I need to initialize the variable tax but I don't know how too in a main class. Here is my code.
System.out.println("Enter your income!");
double income = scan.nextDouble();
if (income < 50000)
{
double tax = income / 100;
}
else if (income < 75000)
{
double tax = income / 100 * 2;
}
else if (income < 100000)
{
double tax = income / 100 * 3;
}
else if (income < 250000)
{
double tax = income / 100 * 4;
}
else if (income < 500000)
{
double tax = income / 100 * 5;
}
else if (income > 500000)
{
double tax = income / 100 * 6;
}
Aucun commentaire:
Enregistrer un commentaire