Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A certain country has the following (income) tax schedule: If the income is less

ID: 3835459 • Letter: A

Question

A certain country has the following (income) tax schedule: If the income is less than $10,000 this schedule is not applicable. If the income is between $10,000 and $30,000, the tax is equal to $2,000 plus 5% of the income above $10,000. If the income is between $30,000 and $60,000, the tax is equal to the tax corresponding to $30,000 plus 8% of the excess over $30,000. If the income is between $60,000 and $100,000, the tax is equal to the tax corresponding to $60,000 plus 10% of the excess over $60,000. If the income is more than $100,000, the tax is equal to the tax corresponding to $100,000 plus 15% of the excess over $100,000. Write a script to calculate the tax for a user specified income. Your script should do the following: Prompt the user for the income. Calculate the tax. Display the tax when the schedule is applicable. Display an error message when the schedule is not applicable. Your script must use 'input', 'if..', and 'fprintf' statements. The basic syntax of these statements is as follows: var = input('Message'); fprintf('Message: %g %g ', var1, var2, ...); if (logical expression) block of statements else block of statements end

Explanation / Answer

Algorithm

1. Read income from user

2. float t1=2000+0.05*20000;

3. float t2= t1+0.08*30000;

4. float t3= t2+0.10*40000;

5. if income<10000 then

               5.1 Print “schedule is not applicable”

6. else if income is between 10000 and 30000 then

               6.1 diff=income-10000

               6.2 tax= 2000+0.05*diff

               6.3 print “tax is” +tax

7.else if income is between 30000 and 60000 then

               7.1 diff=income-30000

               7.2 tax= t1+0.05*diff

               7.3 print “tax is” +tax

8. else if income is between 60000 and 100000 then

               8.1 diff=income-60000

               8.2 tax= t2+0.08*diff

               8.3 print “tax is” +tax

9.else if income>100000

               9.1 diff=income-100000

               9.2 tax= t3+0.08*diff

               9.3 print “tax is” +tax

PROGRAM

income=input ("Enter your income");
Print (income)
i = float(raw_input("i: "))
i >= 0
t1=2000+0.05*20000
t2= t1+0.08*30000
t3= t2+0.10*40000
while True:
if i < 10000:
tax = 0
elif i > 10000 and i <= 30000:
tax = (i-10000)*(0.05)+2000
elif i > 30000 and i <= 60000:
tax = (i-30000)*(0.08)+t1
elif i > 60000 and i <= 100000:
tax = (i-60000)*(0.1)+t2
elif i > 100000:
tax = (i–100000)*(0.15)+t3
return tax
if (tax > 0)
fprintf “Tax is %f”, %tax
else
fprintf “Tax is not applicable”

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote