Question

Write a Java program that accepts the salary of an employee, then deducts the income tax...

Write a Java program that accepts the salary of an employee, then deducts the income tax from the salary on the following basis: 30% income tax if the salary is above or equal $15000. 20% income tax if the salary is between $7000 and $15000. 10% income tax if the salary is below or equal $7000. Your program then should output the salary, income tax and the net salary.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
//IncomeTax.java
import java.util.Scanner;
public class IncomeTax {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("Enter salary: ");
        double salary = scan.nextDouble();
        double tax = 0;
        if(salary>=15000){
            tax = salary*30/100;
        }
        else if(salary>=7000){
            tax = salary*20/100;
        }
        else{
            tax = salary*10/100;
        }

        System.out.println("Salary: $"+salary);
        System.out.println("Tax: $"+tax);
        System.out.println("Net salary: $"+(salary-tax));
    }
}

Add a comment
Know the answer?
Add Answer to:
Write a Java program that accepts the salary of an employee, then deducts the income tax...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT