logo CodeStepByStep logo


Language/Type: VB if/else function basics return

Write a function named ComputeTax that accepts a salary as a parameter and that returns the amount of tax you would owe if you make that salary. The tax is based on your tax bracket as found from the first two columns below. Once you know which row to use, start with the "flat amount" and add the "plus %" of the amount over the amount listed in the final column. For example, if your income is $50,000, then you use the third row of the table and compute the tax as $4,000 plus 25% of the amount over $29,050, which comes to $9,237.50. The total tax on $27,500 is $3,767.50. For $6,000, the tax is $600. For $120,000, the tax is $28,227. Assume your function is passed a value ≥ 0.

over but not over flat amount plus % of excess over
$0 $7,150 $0 10% $0
$7150 $29,050 $715 15% $7,150
$29,050 $70,350 $4000 25% $29,050
$70,350 unlimited $14,325 28% $70,350
Function: Write a VB function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.