Results 1 to 4 of 4
Thread: Roman numeral to Decimal
- 04-03-2009, 11:31 AM #1
Member
- Join Date
- Apr 2009
- Posts
- 1
- Rep Power
- 0
- 04-03-2009, 09:47 PM #2
Presumably you know how roman numerals work? You'll need to step through a string character by character, keeping track of the sum you have reached. If you get to a character of higher value than the previous, then you do a subtraction. You probably need to keep track of 3 numbers to deal with stuff like MIIC. You also need to decide whether you're going to try and handle non-standard forms (XCIIX vs. IIC) or just throw a malformed exception.
- 04-04-2009, 05:18 AM #3
I would step through the String backwards, starting at the last character.
And MIIC, XCIIX and IIC are *all* illegal as roman numerals. 98 can be written one way and one way only: XCVIII. 1098 would be MXCVIII
db
- 04-04-2009, 07:48 PM #4
Similar Threads
-
Convert roman numerals
By matzahboy in forum New To JavaReplies: 4Last Post: 02-21-2010, 10:06 PM -
Eclipse- Decimal to binary
By queen_vee in forum New To JavaReplies: 1Last Post: 02-24-2009, 02:17 PM -
Percentage/decimal points?
By Exhonour in forum New To JavaReplies: 6Last Post: 01-16-2009, 10:35 PM -
decimal calculations?
By arnab321 in forum CLDC and MIDPReplies: 5Last Post: 11-19-2008, 03:36 AM -
Convert roman numerals to integers
By Felissa in forum Advanced JavaReplies: 2Last Post: 07-01-2007, 11:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks