Cody

Solution 2124828

Submitted on 11 Feb 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
numbers=[9 8]; operator='+'; value=1; assert(isequal(ReverseCalculator(numbers,operator),value))

ans = '0 1'

Error using str2num Too many input arguments. Error in ReverseCalculator (line 3) str2num(ans(1),operator,ans(2)) Error in Test1 (line 4) assert(isequal(ReverseCalculator(numbers,operator),value))

2   Fail
numbers=[7 2]; operator='-'; value=-5; assert(isequal(ReverseCalculator(numbers,operator),value))

ans = '2 7'

Error using str2num Too many input arguments. Error in ReverseCalculator (line 3) str2num(ans(1),operator,ans(2)) Error in Test2 (line 4) assert(isequal(ReverseCalculator(numbers,operator),value))

3   Fail
numbers=[0 6]; operator='/'; value=3; assert(isequal(ReverseCalculator(numbers,operator),value))

ans = '9 3'

Error using str2num Too many input arguments. Error in ReverseCalculator (line 3) str2num(ans(1),operator,ans(2)) Error in Test3 (line 4) assert(isequal(ReverseCalculator(numbers,operator),value))

4   Fail
numbers=[1 5]; operator='*'; value=32; assert(isequal(ReverseCalculator(numbers,operator),value))

ans = '8 4'

Error using str2num Too many input arguments. Error in ReverseCalculator (line 3) str2num(ans(1),operator,ans(2)) Error in Test4 (line 4) assert(isequal(ReverseCalculator(numbers,operator),value))