• Post Reply Bookmark Topic Watch Topic
  • New Topic

Arabic to Roman Numeral converter  RSS feed

 
Laura Tobin
Greenhorn
Posts: 18
Eclipse IDE Java Postgres Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, so, I am back in class and have homework! I got part of this converter built and running fine but now it's getting weird. Specifically I am getting to the part where I have to count above ten which means things like attaching Vs to Is and Xs and suchlike.

I know I have to use an .append someplace, I am just not certain how to go about it. I've been playing with it some, but this is honestly the biggest thing I've built so far that actually *ran* so I'm afraid to poke too many holes in it... where do I start? It's not like I can invent another return string and concatenate them. R is what I've got.

The stuff that's commented out - specifically the other Int and the other method - are for a future possible Roman-to-Arabic converter, so just feel free to ignore them. Thanks

 
Paweł Baczyński
Bartender
Posts: 2087
44
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My advice is StopCoding. Figure out on paper how to convert a decimal number to roman number.
Only start coding when you are able to produce a list of steps that need to be done so 5-years-old could do it.
Remember, computer is dumb. It will do exactly what you tell it to do. And it will have no idea what is it doing really.

When writing a program compile ofter. Something about every 4-5 lines. Do not proceed until what you have written so far works correctly.

First thing that came to my mind. Validate your inputs at the very beginning of the method. Not hidden somewhere inside loop.
Second, unless this is specifically required by the assignment do not call your method toRo. It is cryptic.
A method's name should tell you what the method does. Better name would be toRoman.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!