Cody

Problem 46114. Compute the date of a special marriage milestone

Solution 2816713

Submitted on 10 Aug 2020 by Tim
  • Size: 39
  • This is the leading solution.
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   Pass
% Simple test b1 = '2020-01-01'; b2 = '2020-01-03'; w = '2020-01-07'; a1_correct = '2020-01-13'; a2_correct = '2020-01-11'; [a1,a2] = MarriageMilestone(b1,b2,w); assert(isequal(a1,a1_correct) && isequal(a2,a2_correct))

2   Pass
b1 = '1970-05-04'; b2 = '1971-11-16'; w = '1992-08-04'; a1_correct = '2014-11-05'; a2_correct = '2013-04-23'; [a1,a2] = MarriageMilestone(b1,b2,w); assert(isequal(a1,a1_correct) && isequal(a2,a2_correct))

3   Pass
b1 = '1961-08-04'; b2 = '1964-01-17'; w = '1992-10-03'; a1_correct = '2023-12-03'; a2_correct = '2021-06-20'; [a1,a2] = MarriageMilestone(b1,b2,w); assert(isequal(a1,a1_correct) && isequal(a2,a2_correct))

4   Pass
b1 = '1958-11-12'; b2 = '1970-06-26'; w = '2003-09-20'; a1_correct = '2048-07-28'; a2_correct = '2036-12-14'; [a1,a2] = MarriageMilestone(b1,b2,w); assert(isequal(a1,a1_correct) && isequal(a2,a2_correct))

5   Pass
b1 = '1967-04-21'; b2 = '1967-06-13'; w = '1994-07-31'; a1_correct = '2021-11-09'; a2_correct = '2021-09-17'; [a1,a2] = MarriageMilestone(b1,b2,w); assert(isequal(a1,a1_correct) && isequal(a2,a2_correct))

6   Pass
b1 = '1991-12-15'; b2 = '1993-07-24'; w = '2019-08-02'; a1_correct = '2047-03-20'; a2_correct = '2045-08-10'; [a1,a2] = MarriageMilestone(b1,b2,w); assert(isequal(a1,a1_correct) && isequal(a2,a2_correct))

Suggested Problems

More from this Author50

Community Treasure Hunt

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

Start Hunting!