Cody

# Problem 44389. Just take it easy for a second or two!

Solution 1313692

Submitted on 25 Oct 2017
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
% Hacking of the Test Suite is not allowed! % Additional restrictions will be added if necessary. assessFunctionAbsence({'!', 'assert', 'evalin', 'assignin', 'system', 'dos', 'unix'}, 'FileName', 'waitForMe.m') assert( isempty( regexp(fileread('waitForMe.m'),'[!]+','match') ) , 'No exclamation marks (!) allowed!!!')

No exclamation marks (!) allowed!!!

2   Pass
t_correct = 1000; c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0178 e = 0.0200

3   Pass
t_correct = 2000; c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 )

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0121 e = 0.0100

4   Pass
t_correct = 1000; for r = 1 : 3 c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 ) end;

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0119 e = 0.0100 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0114 e = 0.0200 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0130 e = 0.0100

5   Pass
t_correct = 2000; for r = 1 : 2 c = cputime; tic; waitForMe(t_correct); t = toc e = cputime - c assert( abs(t_correct - t*1000) <= 0.5 ) assert( e*1000 / t_correct <= 0.05 ) end;

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0124 e = 0.0100 [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] t = 0.0104 e = 0.0100

### Community Treasure Hunt

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

Start Hunting!