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

USE MATLAB: A certain country has the following (income) tax schedule: If the in

ID: 3859870 • Letter: U

Question

USE MATLAB:

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:

a) Prompt the user for the income.

b) Calculate the tax.

c) Display the tax when the schedule is applicable.

d) 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

Document1 Word Q Tell me what you want to do Home Insert Design Layout References Mailings Review View E outline Rule View Side by Side One Page Zoom 100% Multiple pag cDl Synchronous Scrolling Switch Macros New Arrange Split E Page Width Window GEReset indow Position Windows Draft Gridlines Print Web Navigation Pane Mode Layout Layout Zoom Window Acertain ntry has the following (income] tax schedul is less than $10,00 equel to S2,000 plus 5%of the If the between 510,000 d 530,000, the ta $10,000. d$50,000, the sponding to$30,000 pl between 530,000 is equal 8% of the $30,000 $100,000, the taxis orresponding to S60,000 between S60,000 $50,000. plus 1056 of the than $100,000, the tax qual to the ta correspond to $100,000 plus 15% of $100,000. Your script must use 'input', Tfu', and itREintf statements. The basic syntax of these statements is as of st Page 1 of 1 205 words Sign in A share 647 PM 3/13/2017

Explanation / Answer

Program:

income = input('Enter income: ');
tax=0;
if(income > 10000)
if(income < 30000)
tax = 0.05*(income-10000);
else
tax = 0.05*(20000);
if(income<60000)
tax =tax + (income-30000)*0.08;
else
tax = tax + (30000)*0.08;
if(income<100000)
tax = tax + (income-60000)*0.1;
else
tax = tax + (income - 100000)*0.15';
end
end
end
fprintf('INCOME : %0.2f TAX : %0.2f ',income,tax);
else
fprintf('The schedule is not applicable ');
end

Result:

INCOME : 12000.00INCOME : 100.00>> taxCalculate
Enter income: 12000
INCOME : 12000.00
TAX : 100.00
>> taxCalculate
Enter income: 5000
The schedule is not applicable
>> taxCalculate
Enter income: 15000
INCOME : 15000.00
TAX : 250.00
>> taxCalculate
Enter income: 40000
INCOME : 40000.00
TAX : 1800.00
>> taxCalculate
Enter income: 80000
INCOME : 80000.00
TAX : 5400.00

>> taxCalculate
Enter income: 150000
INCOME : 150000.00
TAX : 10900.00