I'm against doing people's homework for them, but here are some hints:
You'll need a data table of some sort such as an associative array to relate each roman digit (i, v, x, etc.) to its decimal equivalent.
Walk through the roman numeral string character by character. If the character is not the last in the string, look at the next character, and if the next character is greater than the current character, subtract the current character's decimal value from the running total, otherwise add it to the total.