Cody

# Problem 1469. Net Present Value of a Stream of Cash Flows

Solution 1702786

Submitted on 5 Jan 2019 by HH
• Size: 9
• 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
F = [100 -50 35]; i = 0.05; y_correct = 80.121; assert(isequal(calc_present(F,i),y_correct))

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

2   Pass
F = [100]; i = 0.20; y_correct = 83.333; assert(isequal(calc_present(F,i),y_correct))

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

3   Pass
F = [-50]; i = 0.235; y_correct = -40.486; assert(isequal(calc_present(F,i),y_correct))

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

4   Pass
F = [20 50 50 50 0 100]; i = 0.085; y_correct = 197.425; assert(isequal(calc_present(F,i),y_correct))

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