Cody

Problem 45758. Mo money, mo math 1! (★★★)

Solution 2520326

Submitted on 11 Jun 2020 by Ramesh Kumar V
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
x = [1 0 0 0 0 3 0 0]; y_correct = 20.30; assert(isequal(mymoney(x),y_correct))

m = 20.0000 10.0000 5.0000 1.0000 0.2500 0.1000 0.0500 0.0100 y1 = 20.3000 y = 20.3000

2   Pass
x = [1 0 1 0 2 3 0 0]; y_correct = 25.80; assert(isequal(mymoney(x),y_correct))

m = 20.0000 10.0000 5.0000 1.0000 0.2500 0.1000 0.0500 0.0100 y1 = 25.8000 y = 25.8000

3   Pass
x = [0 0 0 3 2 3 5 9]; y_correct = 4.14; assert(isequal(mymoney(x),y_correct))

m = 20.0000 10.0000 5.0000 1.0000 0.2500 0.1000 0.0500 0.0100 y1 = 4.1400 y = 4.1400

4   Pass
x = [1 2 0 0 0 0 0 0]; y_correct = 40.00; assert(isequal(mymoney(x),y_correct))

m = 20.0000 10.0000 5.0000 1.0000 0.2500 0.1000 0.0500 0.0100 y1 = 40 y = 40

Suggested Problems

More from this Author46

Community Treasure Hunt

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

Start Hunting!