Question: Develop a program that computes tax based on a user's salary using the provided decision table. When a user inputs their salary, the program should

Develop a program that computes tax based on a user's salary using the provided decision table. When a user inputs their salary, the program should determine the corresponding salary range in the decision table. The decision table outlines various salary brackets, each associated with a specific base tax amount and an excess percentage rate. To calculate the total tax, the program should add the base tax to the product of the excess percentage and the amount by which the salary exceeds the lower threshold of the identified range. Make sure you have comments to explain your code.
Decision Table:
\table[[Salary Range (USD),Base Tax (USD),Percentage of Excess (%)],[0-9,999.99,0,10],[10,000-19,999.99,1,000,12],[20,000-29,999.99,2,200,15],[30,000-39,999.99,3,300,18],[40,000-49,999.99,4,400,20]]
\table[[Salary Range (USD),Base Tax (USD),Percentage of Excess (%)],[50,000 and above,5,500,25]]
Example:
For a salary of $23,000, the program would identify the range $20,000-$29,999.99. The base tax for this range is $2,200, and the percentage of excess is 15%. The salary exceeds the lower end of the range by $3,000($23,000-$20,000). Therefore, the excess tax would be 15% of $3,000, which is $450. The total tax would be the sum of the base tax and the excess tax, amounting to $2,200+$450=$2,650.
Enter your salary: 23000 Total tax to pay: $2650.00
Another example:
Enter your salary: 36900
Total tax to pav: $4542.00
 Develop a program that computes tax based on a user's salary

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!