- 1 -> I -> 1
- 2 -> II -> 2
- 3 -> III -> 3
- 4 -> IV -> 4
- 5 -> V -> 5
- 6 -> VI -> 6
- 7 -> VII -> 7
- 8 -> VIII -> 8
- 9 -> IX -> 9
- 10 -> X -> 10
Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.
Forum Search
Highly Rated Users
Forum Statistics
UsersTotal Post History
- Posts:
- 45705
- Topics:
- 9398
7-Day Post History
- New Posts:
- 343
- New Topics:
- 81
- Active Topics:
- 90
Our newest member
Other
-
FAQ
All times are UTC [ DST ]
Google Ads
LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Forum rules
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
Always post answers in a "Hidecode" tag, so that others have a chance to answer the question too.
15 posts • Page 1 of 1
Please wait...
LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
The puzzle this week is simple.
Write a program to convert to (and from) roman numerals. So your program should be able to take the input of 27 and return XXVII, and take MCMLXXXI and return 1981. And of course any other values.
The program must work for all numbers between the upper bound of 4000 and the lower bound of 0 (both non-inclusive)
Bonus points if you check incoming roman numerals for well-formedness (this lists some of the rules: http://en.wikipedia.org/wiki/Roman_nume ... n_numerals)
Have Fun!
Write a program to convert to (and from) roman numerals. So your program should be able to take the input of 27 and return XXVII, and take MCMLXXXI and return 1981. And of course any other values.
The program must work for all numbers between the upper bound of 4000 and the lower bound of 0 (both non-inclusive)
Bonus points if you check incoming roman numerals for well-formedness (this lists some of the rules: http://en.wikipedia.org/wiki/Roman_nume ... n_numerals)
Have Fun!
And we have contraptions like computers that cheat you out of becoming. Bill Gates says, "Wait till you see what your computer can become." But it's you who should be doing the becoming, not the damn fool computer.
My Crummy Web Page
My Crummy Web Page
-

AlexCuse - LTD Admin

-








- Posts: 3532
- Joined: Tue Oct 09, 2007 5:26 pm
- Location: Pennsylvania, US
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
M!ke
God is great. Beer is good. People are crazy.
God is great. Beer is good. People are crazy.
-

LNBruno - LTD Senior Moderator

-


- Posts: 645
- Joined: Thu Oct 18, 2007 9:00 pm
- Location: Charlotte, NC
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Rats! Left off the final END in the first blob o' code.
M!ke
God is great. Beer is good. People are crazy.
God is great. Beer is good. People are crazy.
-

LNBruno - LTD Senior Moderator

-


- Posts: 645
- Joined: Thu Oct 18, 2007 9:00 pm
- Location: Charlotte, NC
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
LNBruno wrote:Rats! Left off the final END in the first blob o' code.
you can edit your code. Like me
I made it a hidecode tags instead of hide tags.-

chrissie1 - LTD Admin

-










- Posts: 6038
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Mike, please tell me it was squirelled away from a past puzzle, and not production code 

And we have contraptions like computers that cheat you out of becoming. Bill Gates says, "Wait till you see what your computer can become." But it's you who should be doing the becoming, not the damn fool computer.
My Crummy Web Page
My Crummy Web Page
-

AlexCuse - LTD Admin

-








- Posts: 3532
- Joined: Tue Oct 09, 2007 5:26 pm
- Location: Pennsylvania, US
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Hey, cool! Didn't know I could edit my post, chrissie! Thanks.
And Alex, of course it was from a past puzzle! Definitely, absolutely not, I repeat, NOT any production code I ever had to write...
Okay, okay! I confess! It was production code.
And Alex, of course it was from a past puzzle! Definitely, absolutely not, I repeat, NOT any production code I ever had to write...
Okay, okay! I confess! It was production code.

M!ke
God is great. Beer is good. People are crazy.
God is great. Beer is good. People are crazy.
-

LNBruno - LTD Senior Moderator

-


- Posts: 645
- Joined: Thu Oct 18, 2007 9:00 pm
- Location: Charlotte, NC
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
DOH! Edit button, ID10T!
Did I mention that I'm glad it's Friday?
Did I mention that I'm glad it's Friday?
M!ke
God is great. Beer is good. People are crazy.
God is great. Beer is good. People are crazy.
-

LNBruno - LTD Senior Moderator

-


- Posts: 645
- Joined: Thu Oct 18, 2007 9:00 pm
- Location: Charlotte, NC
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
LNBruno wrote:Hey, cool! Didn't know I could edit my post, chrissie! Thanks.
And Alex, of course it was from a past puzzle! Definitely, absolutely not, I repeat, NOT any production code I ever had to write...
Okay, okay! I confess! It was production code.
Do you use papiri or wax tablets for your code?

x
-

Remou - LTD Admin

-






- Posts: 3160
- Joined: Sun Oct 14, 2007 11:26 am
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Remou asked: Do you use papiri or wax tablets for your code?
We're still on Stone Tablets (beta).

M!ke
God is great. Beer is good. People are crazy.
God is great. Beer is good. People are crazy.
-

LNBruno - LTD Senior Moderator

-


- Posts: 645
- Joined: Thu Oct 18, 2007 9:00 pm
- Location: Charlotte, NC
-

Remou - LTD Admin

-






- Posts: 3160
- Joined: Sun Oct 14, 2007 11:26 am
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Here's an ASP.NET version:
Code is hidden, SHOW
-

ca8msm - LTD Admin

-







- Posts: 1986
- Joined: Wed Oct 10, 2007 6:49 pm
- Location: North East England
A solution in java using enums
Here is a solution in java which does some validation on the roman input,
the roman digits are represented by enums
the roman digits are represented by enums
Code is hidden, SHOW
- shamsm
- Apprentice

-
- Posts: 12
- Joined: Wed Jul 30, 2008 10:09 am
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
My solution. Not fully completed (some checks should be implemented) but it (seems to) works. I used some test from shamsm (thanks).
Code is hidden, SHOW
- b3orn
- Apprentice

-
- Posts: 9
- Joined: Thu Jul 17, 2008 3:23 pm
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
PHP, quick and dirty (without validations):
Output, first 10 lines:
Code is hidden, SHOW
Output, first 10 lines:
Last edited by tisodotsk on Fri Aug 08, 2008 1:14 pm, edited 1 time in total.
I try to improve my English language skills. Most things i do better than this.
- tisodotsk
- Apprentice

-

- Posts: 22
- Joined: Fri Aug 08, 2008 12:45 pm
- Location: Bratislava, Slovakia
Re: LTD Puzzle VIII - Convert Between Roman and Arabic Numerals
Validation is for sissies 
You just have to select smarter users.

You just have to select smarter users.
-

chrissie1 - LTD Admin

-










- Posts: 6038
- Joined: Wed Oct 10, 2007 7:18 pm
- Location: Belgium
15 posts • Page 1 of 1



LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.