Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

converting from integers to roman numerals

807597Aug 20 2005 — edited Aug 21 2005
i'm new to the whole programming scene, so I've been working with a few practice programs. I've got this one extremely close to working, but the compiler still gives me one error, and it completely baffles me. here's the code:
package practiceprograms;
import java.io.*;

public class RomanNumerals {
	//ButtonCreator c = new ButtonCreator(); //uncomment at start of line to implement GUI and all other full line comments too.
	public static void main(String[] args) {
		//console.run(new ButtonCreator(), 200, 100);
		Numerals.removeNumbers(String number, int i);
	}
}
class Numerals {
	static void removeNumbers(String s, int x) {
		GetNumber b = new GetNumber();
		while (x != 0){
			b.getInput(x);
			if (x < 0) {
				x = -x;
				s += "Negative ";
			}
			for(; x>=1000; x -= 1000) {
				s += "M";
			}
			for(; x>=100; x -= 100) {
				s += "C";
			}
			for(; x>=50; x -= 50) {
				s += "L";
			}
			for(; x>=10; x -= 10) {
				s += "X";
			}
			for(; x>=5; x -= 5) {
				s += "V";
			}
			for(; x>=1; x--) {
				s += "I";
			}
		//if (i = null)
		//	c.actionPerformed();
		}
		System.out.println(s);
			//txt.setText(s);
	}
}
class GetNumber {
	int getInput(int x) throws IOException {
		System.out.println("Please enter a non-zero number between -10000 and 10000. If you enter zero, the program will quit.");
		System.out.println("Return a blank line or zero to quit the program.");
		BufferedReader in = new BufferedReader(
			new InputStreamReader(System.in));
		x = in.readline();
		GetNumber.getInput(x);
        return x;
	}
	int checkI(int t) {
		if (t > 10000 | t < -10000) {
			System.out.println("Err: Please enter a non-zero number between -10000 and 10000.");
			GetNumber n = new GetNumber();
			n.getInput();
			n.checkI(i);
			return i;
		}
		else 
			return t;
	}
} 
and the error it gives me:

C:\Documents and Settings\Aishu\Desktop\java class and source files\RomanNumerals.java:8: ')' expected
Numerals.removeNumbers(String number, int i);
^
1 error
its irritating, because its almost saying that the method removeNumbers shouldn't take any arguments... or atleast thats what it seems like to me... any ideas as to what the problem is?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 18 2005
Added on Aug 20 2005
12 comments
511 views