Cody

Problem 42352. Days until next NewYear ball drop

Solution 2887952

Submitted on 28 Aug 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
x= '2015-05-26'; y_correct = 220; assert(isequal(Days2NYE(x),y_correct))

Undefined function 'year' for input arguments of type 'char'. Error in Days2NYE (line 3) floor(datenum(year(x)+1, 01, 01, 00, 00, 0) - datenum(x)); Error in Test1 (line 3) assert(isequal(Days2NYE(x),y_correct))

2   Fail
x = '2015-12-30'; y_correct = 2; assert(isequal(Days2NYE(x),y_correct))

Undefined function 'year' for input arguments of type 'char'. Error in Days2NYE (line 3) floor(datenum(year(x)+1, 01, 01, 00, 00, 0) - datenum(x)); Error in Test2 (line 3) assert(isequal(Days2NYE(x),y_correct))

3   Fail
x = '2014-05-26 10:15:45'; y_correct = 219; assert(isequal(Days2NYE(x),y_correct))

Undefined function 'year' for input arguments of type 'char'. Error in Days2NYE (line 3) floor(datenum(year(x)+1, 01, 01, 00, 00, 0) - datenum(x)); Error in Test3 (line 3) assert(isequal(Days2NYE(x),y_correct))

4   Fail
x = '2014-12-31 10:15:45'; y_correct = 0; assert(isequal(Days2NYE(x),y_correct))

Undefined function 'year' for input arguments of type 'char'. Error in Days2NYE (line 3) floor(datenum(year(x)+1, 01, 01, 00, 00, 0) - datenum(x)); Error in Test4 (line 3) assert(isequal(Days2NYE(x),y_correct))

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!