Help??!

Write a MATLAB program that computes the amount of income tax a person
needs to pay according to the following table:
Salary Range ($) Base Tax ($) Percentage of Excess
0.00 14,999.99 0.00 15
15,000.00 29,999.99 2,250.00 18
30,000.00 49,999.99 5,400.00 22
50,000.00 79,999.99 11,000.00 27
80,000.00 149,999.99 21,600.00 33
>= 150,000.00 32,000.00 40
For example, if a persons salary is $2,000.00, the income tax the person needs to pay is
$2,250.00 (base tax for the second range) plus 18% of the excess salary over $15,000.00 (that
is, 18% of $5,000). Therefore, the total tax due is $2,250.00 plus $900.00, which is
$3,150.00.
Your program should first prompt the user to input a salary amount (with the prompt of
Please enter the salary amount: ”), then based on the amount and the above
table calculate the total amount of income tax. Your program should output to the command
window the total amount of tax as follows:
The total tax due is:
x
where x is the calculated total amount of tax with two digits after the decimal point. For
example, if the calculated amount is $3,150, the value should be displayed as 3150.00. If the
salary amount inputted by the user is negative, your program should output to the command
window:
invalid input

3 Commenti

nanren888
nanren888 il 23 Feb 2012
The main thing, Richelle, is to make a start.
Jan
Jan il 23 Feb 2012
@Richelle: What have you done so far and which problems occurred?
Walter Roberson
Walter Roberson il 23 Feb 2012
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Operators and Elementary Operations in Centro assistenza e File Exchange

Richiesto:

il 23 Feb 2012

Modificato:

il 21 Ott 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by