# convert roman numeral to number

• 01-27-2011, 06:19 AM
the beginner
convert roman numeral to number
i just want to know if there is someone who is interested to help me out to convert roman numeral using CASE, STRING FORMAT :( i don't even know how to get started kinda confused :( i just hope someone will help me out...

thankz

-angie-
• 01-27-2011, 06:38 AM
Junky
Quote:

Originally Posted by the beginner
i don't even know how to get started

I find that hard to believe. You cannot even write a simple program like Helloworld? If so then you either need some intensive revision or drop the course. If you do know how to do HelloWorld then you do know how to start.

Take baby steps. Write a class that is nothing more than hae the correct name and prints out a simple message. Then move onto printing something like the decimal equivalent of each Roman numeral. Then advance to if user enters 5 it prints out V etc etc.
• 01-27-2011, 06:45 AM
the beginner
i didn't exactly mean that i didn't really know how to get started. I was just confused. i got something in mind but when i think about something else thats where i messed up.. lol :) thanks for the comment anyways :) it's ugly but it's ok :)
• 01-27-2011, 07:49 AM
gcalvin
Do the parts you know how to do first. Choose a name for your class. You probably need just one instance variable: an int to store the number you're going to convert. You should have a void setArabic(int number), a void setRoman(String numeral), an int getArabic(), and a String getRoman(). For starters, keep the methods simple. Your getArabic() and setArabic() methods just save and return the number. For starters, the number will be either a 1 or a 5 -- nothing else. That should make getRoman() and setRoman() easy to implement. Write your main() method with all the Scanner and System.out.println() code, and get that much working properly.

Then you just have to do the real setRoman() and getRoman() methods, and you'll have a framework for testing them. Start small and improve them incrementally. Make them work just for 1-10 first, then get it working for 1-50, then 1-100 and so on.

-Gary-