Cody

Problem 44445. Tax Calculator

Solution 2751883

Submitted on 28 Jul 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
income = 0; tax_correct = 0; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test1 (line 3) assert(isequal(taxFor(income),tax_correct))

2   Fail
income = 100; tax_correct = 10; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test2 (line 3) assert(isequal(taxFor(income),tax_correct))

3   Fail
income = 1000; tax_correct = 100; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test3 (line 3) assert(isequal(taxFor(income),tax_correct))

4   Fail
income = 2000; tax_correct = 200; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test4 (line 3) assert(isequal(taxFor(income),tax_correct))

5   Fail
income = 2500; tax_correct = 300; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test5 (line 3) assert(isequal(taxFor(income),tax_correct))

6   Fail
income = 3000; tax_correct = 400; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test6 (line 3) assert(isequal(taxFor(income),tax_correct))

7   Fail
income = 5000; tax_correct = 1000; assert(isequal(taxFor(income),tax_correct))

Unrecognized function or variable 'x'. Error in taxFor (line 2) if x<2000 Error in Test7 (line 3) assert(isequal(taxFor(income),tax_correct))

8   Pass
filetext = fileread('taxFor.m'); assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')

Suggested Problems

More from this Author25

Community Treasure Hunt

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

Start Hunting!