R
RedGrittyBrick
emilie wrote:
<snip: source code for program to calculate Greatest Common Divisor of
two integers using the Euclidian algorithm>
You posted this identical message to a half dozen reponses in this
thread. That means I have read this exact same text many times over.
Try to imagine the effect that has on how people feel about helping you.
To get the best out of newsgroups I find I need to be specific. Exactly
what error message did you get? Using cut & paste prevents typing errors
and saves time.
You might like to read some guidelines on getting the best out of
newsgroups ...
http://www.catb.org/~esr/faqs/smart-questions.html
I loaded your original code into Eclipse and it said "Console cannot be
resolved" at this line:
int x = Console.readInt();
I looked up the Javadocs for Console at
http://java.sun.com/javase/6/docs/api/java/io/Console.html
and noted that it says "Since: 1.6".
I am using 1.5. That explains that error I guess.
I therefore changed the start of the program as follows
public static void main(String[] args) throws IOException {
InputStreamReader stdin = new InputStreamReader(System.in);
BufferedReader console = new BufferedReader(stdin);
String s = console.readLine();
int x = Integer.parseInt(s);
Ditto for y.
Eclipse said "The constructor GCDSolver(int, int) is undefined" at this
line:
GCDSolver solver = new GCDSolver(x, y);
So I changed
public void GCDsolver(int a, int b){
to
GCDSolver(int a, int b){
(Note the capital S)
After that it worked.
Merry Xmas!
<snip: source code for program to calculate Greatest Common Divisor of
two integers using the Euclidian algorithm>
actually, my assignment is just to fill up some missing informations.
You posted this identical message to a half dozen reponses in this
thread. That means I have read this exact same text many times over.
Try to imagine the effect that has on how people feel about helping you.
the only problem with my code is the console.readInt. Everytime i
compile it, an error appears regarding it..thanks!
To get the best out of newsgroups I find I need to be specific. Exactly
what error message did you get? Using cut & paste prevents typing errors
and saves time.
You might like to read some guidelines on getting the best out of
newsgroups ...
http://www.catb.org/~esr/faqs/smart-questions.html
I loaded your original code into Eclipse and it said "Console cannot be
resolved" at this line:
int x = Console.readInt();
I looked up the Javadocs for Console at
http://java.sun.com/javase/6/docs/api/java/io/Console.html
and noted that it says "Since: 1.6".
I am using 1.5. That explains that error I guess.
I therefore changed the start of the program as follows
public static void main(String[] args) throws IOException {
InputStreamReader stdin = new InputStreamReader(System.in);
BufferedReader console = new BufferedReader(stdin);
String s = console.readLine();
int x = Integer.parseInt(s);
Ditto for y.
Eclipse said "The constructor GCDSolver(int, int) is undefined" at this
line:
GCDSolver solver = new GCDSolver(x, y);
So I changed
public void GCDsolver(int a, int b){
to
GCDSolver(int a, int b){
(Note the capital S)
After that it worked.
Merry Xmas!