Cody

# Problem 3004. Two functions (to be sure)

Solution 2074478

Submitted on 30 Dec 2019
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
x = 1; assert(isequal(odd_fcn(x),1)) assert(isequal(even_fcn(x),0))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint1 (line 2) In solutionTest (line 3)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint1 (line 3) In solutionTest (line 3)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test1 (line 3) assert(isequal(even_fcn(x),0))

2   Fail
y = 2; assert(isequal(odd_fcn(y),0)) assert(isequal(even_fcn(y),1))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint2 (line 2) In solutionTest (line 5)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint2 (line 3) In solutionTest (line 5)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test2 (line 3) assert(isequal(even_fcn(y),1))

3   Fail
x = [1 2]; assert(isequal(odd_fcn(x),1)) assert(isequal(even_fcn(x),1))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint3 (line 2) In solutionTest (line 7)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint3 (line 3) In solutionTest (line 7)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test3 (line 3) assert(isequal(even_fcn(x),1))

4   Fail
x = 1:10; assert(isequal(odd_fcn(x),5)) assert(isequal(even_fcn(x),5))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint4 (line 2) In solutionTest (line 9)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint4 (line 3) In solutionTest (line 9)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test4 (line 3) assert(isequal(even_fcn(x),5))

5   Fail
x = 1:100; assert(isequal(odd_fcn(x),50)) assert(isequal(even_fcn(x),50))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint5 (line 2) In solutionTest (line 11)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint5 (line 3) In solutionTest (line 11)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test5 (line 3) assert(isequal(even_fcn(x),50))

6   Fail
x=(2:2:1000)'; assert(isequal(odd_fcn(x),0)) assert(isequal(even_fcn(x),500))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint6 (line 2) In solutionTest (line 13)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint6 (line 3) In solutionTest (line 13)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test6 (line 3) assert(isequal(even_fcn(x),500))

7   Fail
x = [1:2:10000]; assert(isequal(odd_fcn(x),5000)) assert(isequal(even_fcn(x),0))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint7 (line 2) In solutionTest (line 15)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint7 (line 3) In solutionTest (line 15)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test7 (line 3) assert(isequal(even_fcn(x),0))

8   Fail
x = [2 1:2:10000]; assert(isequal(odd_fcn(x),5000)) assert(isequal(even_fcn(x),1))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint8 (line 2) In solutionTest (line 17)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint8 (line 3) In solutionTest (line 17)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test8 (line 3) assert(isequal(even_fcn(x),1))

9   Fail
x = [1 2 3;4 5 6;7 8 9]; assert(isequal(odd_fcn(x),5)) assert(isequal(even_fcn(x),4))

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In odd_fcn (line 2) In ScoringEngineTestPoint9 (line 2) In solutionTest (line 19)] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In ScoringEngineTestPoint9 (line 3) In solutionTest (line 19)]

Undefined function 'even_fcn' for input arguments of type 'double'. Error in Test9 (line 3) assert(isequal(even_fcn(x),4))

### Community Treasure Hunt

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

Start Hunting!