hello fellow java programmers. I was wondering if anybody could help
think of a good way to convert roman number in to a base 10 number.
My first thought was to create parallel arrays for numerals and
letters, and the use a for loop, combined with if statements: if
substring of starting letter sequence equals anything from the array,
take that off and add the coresponding numeral to the final result.
But this got really bulky and overbearing. was looking for a better
way.
Thanks.
Graham - 17 Aug 2007 09:59 GMT
On 17 Aug, 09:16, dragonsfal...@gmail.com wrote:
> hello fellow java programmers. I was wondering if anybody could help
> think of a good way to convert roman number in to a base 10 number.
[quoted text clipped - 6 lines]
>
> Thanks.
The Roman Numeral system is already "base-10"!
Ulrich Eckhardt - 17 Aug 2007 12:42 GMT
> The Roman Numeral system is already "base-10"!
That's the Arabian one, not the Roman one, IIRC.
Uli

Signature
Sator Laser GmbH
Geschäftsführer: Ronald Boers, Amtsgericht Hamburg HR B62 932
Patricia Shanahan - 17 Aug 2007 14:11 GMT
>> The Roman Numeral system is already "base-10"!
>
> That's the Arabian one, not the Roman one, IIRC.
>
> Uli
I'm not sure which of two concepts is meant by "base-10" in this context:
1. Being based on powers of ten: Yes. Each character in a Roman Numeral
number represents either a power of ten, or five times a power of ten.
2. Being a positional system in which moving a digit one place
multiplies or divides its value by 10? No. Roman numerals are not
primarily a positional system.
Patricia
Lew - 17 Aug 2007 14:12 GMT
>> The Roman Numeral system is already "base-10"!
>
> That's the Arabian one, not the Roman one, IIRC.
"Arabic", not "Arabian".
Roman numerals are in base 10, in the sense that they are based on a counting
system base 10. They are not in base 10 in the sense that they are not based
on a power-of-10 notation.
This is a standard homework problem. Go to http://mindprod.com and look at
the "Getting Started" link for how to get started on a programming problem.
If you actually /think/ about the problem you'll come up with the code. This
is the sort of thing the OP should figure out for themselves.

Signature
Lew
Aaron Steed - 17 Aug 2007 16:39 GMT
oh i knew it was base 10, i just meant in numerals. I have the
program working, i was basically asking if anybody knew of a more
efficient way to convert them.
Lew - 17 Aug 2007 21:30 GMT
> oh i knew it was base 10, i just meant in numerals. I have the
> program working, i was basically asking if anybody knew of a more
> efficient way to convert them.
More efficient than what?

Signature
Lew
Thomas Schodt - 17 Aug 2007 12:04 GMT
> hello fellow java programmers. I was wondering if anybody could help
> think of a good way to convert roman number in to a base 10 number.
[quoted text clipped - 4 lines]
> But this got really bulky and overbearing. was looking for a better
> way.
http://www.google.com/search?q=java+roman+numerals
http://forum.java.sun.com/thread.jspa?threadID=602867&tstart=0
Roedy Green - 17 Aug 2007 21:18 GMT
>hello fellow java programmers. I was wondering if anybody could help
>think of a good way to convert roman number in to a base 10 number.
The code for going the other way, a much simpler task, is at
http://mindprod.com/products1.html#INWORDS
You could probably find the code you want with google.com, or at least
the algorithm, or the code is some other language.
In Canada you learn to read Roman numerals in about grade 4. Just
write down a number of examples, and do it by hand, and then write an
algorithm to formalize what you are doing. By hand, you pick out
patterns very easily. In your code you will have to find them with a
finite state automaton, or a parser.
See http://mindprod.com/jgloss/finitestate.html
http://mindprod.com/jgloss/parser.html

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
Dr J R Stockton - 18 Aug 2007 16:06 GMT
In comp.lang.java.programmer message <1187338610.108968.86420@q3g2000prf
.googlegroups.com>, Fri, 17 Aug 2007 08:16:50, dragonsfall21@gmail.com
posted:
>hello fellow java programmers. I was wondering if anybody could help
>think of a good way to convert roman number in to a base 10 number.
<URL:http://www.merlyn.demon.co.uk/programs/cvt_rome.pas> has an
algorithm which could be translated.

Signature
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk DOS 3.3, 6.20; WinXP.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>
My DOS <URL:http://www.merlyn.demon.co.uk/batfiles.htm> - also batprogs.htm.
Roedy Green - 18 Aug 2007 23:12 GMT
On Sat, 18 Aug 2007 16:06:38 +0100, Dr J R Stockton
<jrs@merlyn.demon.co.uk> wrote, quoted or indirectly quoted someone
who said :
><URL:http://www.merlyn.demon.co.uk/programs/cvt_rome.pas> has an
>algorithm which could be translated.
see http://mindprod.com/jgloss/romannumerals.html
for Java source code for Roman to long and long to Roman.
The Roman to long also accepts strings which are not valid Roman
numerals and crunches them with the standard algorithm.
Perhaps someone would like to submit an isValid method to insert ahead
of it..

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com