Question: Design a Java program to calculate the tax an employee has to pay based on their salary. The tax rules are as follows: If

Design a Java program to calculate the tax an employee has to

 pay based on their salary. The tax rules are as follows: If

Design a Java program to calculate the tax an employee has to pay based on their salary. The tax rules are as follows: If the salary is R10 000 and below, the tax is 0%. If the salary is more than R10 000 but less than or equal to R20 000, the tax is 10%. If the salary is more than R20 000 but less than R40 000, the tax is 20%. If the salary is more than R40 000, the tax is 25%. Make a class called Employee with three instance variables: name, number, and salary. The class should have a constructor that sets the values of the instance variables. Implement three methods: A method that calculates the tax amount based on the salary. A method that returns the tax percentage as a decimal. A method that displays the employee information including the tax amount and tax percentage. Note: You are not allowed to use a switch statement or if-else chains. Instead, you should use a different control structure to implement the tax calculation. Output - AssQuestionOne (run) x DD Name Employee No 1010 Java BUILD SUCCESSFUL (total time: 2 seconds) Salary R700000.0 After Tax R525000.0 Figure 1.1: Output of the Employee Tax calculation Program. Tax value 25.0%

Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To design a Java program that calculates the tax an employee has to pay based on their salary follow ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!