Cody

Solution 2480531

Submitted on 5 Jun 2020 by Jerry Wright
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 = 1990; y_correct = 'MCMXC'; assert(isequal(dec2rom(x),y_correct))

M = Map with properties: Count: 14 KeyType: double ValueType: any currentValue = 1000 result = "M" currentValue = 900 result = "MCM" currentValue = 500 currentValue = 400 currentValue = 100 currentValue = 90 result = "MCMXC" currentValue = 50 currentValue = 40 currentValue = 10 currentValue = 9 currentValue = 5 currentValue = 4 currentValue = 1 currentValue = 0

2   Pass
x = 2008; y_correct = 'MMVIII'; assert(isequal(dec2rom(x),y_correct))

M = Map with properties: Count: 14 KeyType: double ValueType: any currentValue = 1000 result = "M" result = "MM" currentValue = 900 currentValue = 500 currentValue = 400 currentValue = 100 currentValue = 90 currentValue = 50 currentValue = 40 currentValue = 10 currentValue = 9 currentValue = 5 result = "MMV" currentValue = 4 currentValue = 1 result = "MMVI" result = "MMVII" result = "MMVIII" currentValue = 0

3   Pass
x = 1666; y_correct = 'MDCLXVI'; assert(isequal(dec2rom(x),y_correct))

M = Map with properties: Count: 14 KeyType: double ValueType: any currentValue = 1000 result = "M" currentValue = 900 currentValue = 500 result = "MD" currentValue = 400 currentValue = 100 result = "MDC" currentValue = 90 currentValue = 50 result = "MDCL" currentValue = 40 currentValue = 10 result = "MDCLX" currentValue = 9 currentValue = 5 result = "MDCLXV" currentValue = 4 currentValue = 1 result = "MDCLXVI" currentValue = 0

4   Pass
x = 49; y_correct = 'XLIX'; assert(isequal(dec2rom(x),y_correct))

M = Map with properties: Count: 14 KeyType: double ValueType: any currentValue = 1000 currentValue = 900 currentValue = 500 currentValue = 400 currentValue = 100 currentValue = 90 currentValue = 50 currentValue = 40 result = "XL" currentValue = 10 currentValue = 9 result = "XLIX" currentValue = 5 currentValue = 4 currentValue = 1 currentValue = 0

5   Pass
x = 45; y_correct = 'XLV'; assert(isequal(dec2rom(x),y_correct))

M = Map with properties: Count: 14 KeyType: double ValueType: any currentValue = 1000 currentValue = 900 currentValue = 500 currentValue = 400 currentValue = 100 currentValue = 90 currentValue = 50 currentValue = 40 result = "XL" currentValue = 10 currentValue = 9 currentValue = 5 result = "XLV" currentValue = 4 currentValue = 1 currentValue = 0

6   Pass
x = 0; y_correct = ''; assert(isempty(dec2rom(x)))

M = Map with properties: Count: 14 KeyType: double ValueType: any currentValue = 1000 currentValue = 900 currentValue = 500 currentValue = 400 currentValue = 100 currentValue = 90 currentValue = 50 currentValue = 40 currentValue = 10 currentValue = 9 currentValue = 5 currentValue = 4 currentValue = 1 currentValue = 0