id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

davereed@creighton.edu csc222 > romanToNum
prev  |  next  |  chance

romanToNum() -- You are to convert from a roman numeral (represented as a string of uppercase letters) to its numerical equivalent. Recall that the roman letters correspond to values as follows: 'M' = 1000, 'D' = 500, 'C' = 100, 'L' = 50, 'X' = 10, 'V' = 5, 'I' = 1. You may assume the ancient roman style of writing letters, where 4 is represented "IIII" and 90 is represented "LXXXX".


romanToNum("D") → 500
romanToNum("VII") → 7
romanToNum("XXXIII") → 33

...Save, Compile, Run (ctrl-enter)

public int romanToNum(String roman) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Post-solution available

Copyright Nick Parlante 2017 - privacy