I know you can do this! please help out poor man with MATLAB problem T.T US fede
ID: 672585 • Letter: I
Question
I know you can do this! please help out poor man with MATLAB problem T.T
US federal income taxes are calculated based on taxable income and marital status. For this programming exercise we will only be looking at tax brackets for persons filed as singles, shown in the table below: all rates are valid for values greater than or equal to the lower limit and less than the upper limit But these are based on what is referred to as a "marginal" rate. For example, if you are single and you earned $100,000 per year, you would not owe 28% on all of your income ($28,000). You would owe 10% of $9,075,15% of $27,825 (the difference between the top and the threshold of the second tax bracket: 36900-9075), 25% of $52,450 (89350---36900), and 28% of $10,650 (100000-89350). You would actually owe $21,175.75 and pay an effective tax rate of 21.2%. The effective tax rate is the percent of the tax over the total taxable income. Your task is to write a MATLAB script that prompts the user to confirm their filing status to be single, and their income as a number. It should then calculate and neatly print out their information, the tax they owe and their effective tax rate. If the user does not response with y/Y to confirm their filing status of single, the program will print a proper feedback message and quit It the user does not enter a positive number for the income, the program will keep asking until a valid value is entered. A couple of test cases and example output are given below: Please confirm you are filing federal income taxes as single (Y/N): y Please enter your taxable income ($): 50000 Status: Single Income: $50000.00 Tax Owned: $8356.25 Effective Tax Rate : 16.7% Please confirm you are filing federal income taxes as single (Y/N): N This program does not fit your filing status. Good-bye 1 Please confirm you are filing federal income taxes as single (Y/N): Y Please enter your taxable income ($): 180000 Status: Single Income: $180000.00 Tax Owned: $43575.75 Effective Tax Rate: 24.2%Explanation / Answer
MATLAB Program:
status =input('Please confirm you are filling federal income taxes as single(Y/N):');
if status =='N'
fprintf('This program does not fit your filing status. Good-bye!')
else if status =='Y'
income =input('Please enter your taxable income($):');
while income < 0
income =input('Please enter valid taxable income($):');
end
if income > 0 && income < 9075
TaxOwned = (9075-0)*0.10
ETR = 10%;
fprintf('Staus:%s',"Single");
fprintf('Income:%d',income)
fprintf('Effective Tax Rate:%f', ETR)
else if income >=9075 && income < 36900
TaxOwned = (9075-0)*0.10 + (36900-9075)*0.15
ETR =(10+15)/2;
fprintf('Staus:',"single");
fprintf('Income:'income)
fprintf('Effective Tax Rate:'ETR)
else if income >=36900 && income < 89350
TaxOwned = (9075-0)*0.10 + (36900-9075)*0.15+ (89350-36900)*0.25
ETR = (10+15+25)/3;
fprintf('Staus:%s', "Single");
fprintf('Income:%d',income)
fprintf('Effective Tax Rate:%f',ETR)
else if income >=89350 && income < 186350
TaxOwned = (9075-0)*0.10 + (36900-9075)*0.15+ (89350-36900)*0.25 + (186350-89350)*0.28
ETR = (10+15+25+28)/4;
fprintf('Staus:',"Single");
fprintf('Income:%d',income)
fprintf('Effective Tax Rate:%f',ETR)
else if income >=186350 && income < 405100
TaxOwned = (9075-0)*0.10 + (36900-9075)*0.15+ (89350-36900)*0.25 + (186350-89350)*0.28 +(405100-186350)*0.33
ETR = (10+15+25+28+33)/5
fprintf('Staus:%s',"Single");
fprintf('Income:%d',income)
fprintf('Effective Tax Rate:%f',ETR)
else if income >=405100 && income < 406750
TaxOwned = (9075-0)*0.10 + (36900-9075)*0.15+ (89350-36900)*0.25 + (186350-89350)*0.28 +(405100-186350)*0.33 +(406750-405100)*0.35
ETR = (10+15+25+28+33+35)/6
fprintf('Staus:%s',"Single");
fprintf('Income:%d',income)
fprintf('Effective Tax Rate:%f'ETR)
else if income>=406750
TaxOwned = (9075-0)*0.10 + (36900-9075)*0.15+ (89350-36900)*0.25 + (186350-89350)*0.28 +(405100-186350)*0.33 +(406750-405100)*0.35 +(income-406750)*0.396
ETR = (10+15+25+28+33+35+39.6)/7
fprintf('Staus:%s',"Single");
fprintf('Income:%d',income)
fprintf('Effective Tax Rate:%f',ETR)
else
printf('The entered character is not (Y/N)');
end