Cody

Solution 1422409

Submitted on 23 Jan 2018 by David Verrelli
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))

thousandsDigits = 1 T = 'M' hundredsDigits = 9 h = 'CM' tensDigits = 9 t = 'XC' onesDigits = 0 o = 0×0 empty char array romStr = 'MCMXC'

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

thousandsDigits = 2 T = 'MM' hundredsDigits = 0 h = 0×0 empty char array tensDigits = 0 t = 0×0 empty char array onesDigits = 8 o = 'VIII' romStr = 'MMVIII'

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

thousandsDigits = 1 T = 'M' hundredsDigits = 6 h = 'DC' tensDigits = 6 t = 'LX' onesDigits = 6 o = 'VI' romStr = 'MDCLXVI'

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

thousandsDigits = 0 T = 1×0 empty char array hundredsDigits = 0 h = 0×0 empty char array tensDigits = 4 t = 'XL' onesDigits = 9 o = 'IX' romStr = 'XLIX'

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

thousandsDigits = 0 T = 1×0 empty char array hundredsDigits = 0 h = 0×0 empty char array tensDigits = 4 t = 'XL' onesDigits = 5 o = 'V' romStr = 'XLV'

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

thousandsDigits = 0 T = 1×0 empty char array hundredsDigits = 0 h = 0×0 empty char array tensDigits = 0 t = 0×0 empty char array onesDigits = 0 o = 0×0 empty char array romStr = 1×0 empty char array