Write a Java program to calculate the state tax according to your income. Your p
ID: 3537226 • Letter: W
Question
Write a Java program to calculate the state tax according to your income. Your program should prompt for the income and the user should input the variable via the keyboard, then your program is to calculate the tax according to the following rules: %u2022 if the income is less than or equal to $10000.0 , tax would be 10% of the income. %u2022 if the income is greater than $10000.0 and less than or equal to $30000.0, tax is 15% of the income. %u2022 If the income is greater than $30000.0, tax is 25% of the income. %u2022 if the income is less than or equal to $10000.0 , tax would be 10% of the income. %u2022 if the income is greater than $10000.0 and less than or equal to $30000.0, tax is 15% of the income. %u2022 If the income is greater than $30000.0, tax is 25% of the income.Explanation / Answer
import java.util.Scanner;
class Chegg809
{
public static void main(String args[])
{
int tax;
Scanner input=new Scanner(System.in);
System.out.println("Enter income in $'s");
int a=input.nextInt();
if(a<=10000)
{
tax=a/10;
System.out.println("tax is "+tax+ " $ ");
}
else if((a>10000)&&(a<=30000))
{
tax=a/15;
System.out.println("tax is "+tax+ " $ ");
}
else if(a>30000)
{
tax=a/25;
System.out.println("tax is "+tax+ " $ ");
}
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.