George Siountris

Greenhorn
+ Follow
since Oct 14, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by George Siountris

did a mistake during copy paste..the right adapter class is

[ October 17, 2002: Message edited by: George Siountris ]
21 years ago
In my application I use JmenuBar and JmenuItems and a class adapter for event handling

and a class adapter for event handling

everything works fine when Help|About pressed(the dialog appears)
though when I try to close it I must press ok button twice!?
Need help to solve this problem.(same problem with other dialogs in my application).
21 years ago
I have problem understanding the role of interfaces in java programming. plz if you can post some urls with related topics, witch in your opinion would be helpful. thx in advance
21 years ago
Hey sushant,
Great work, that is an excellent score, i am currently studying for the exam too. Could you please email Heather MacKenzie's notes, Jyothi krishnan's notes to me too. I would really appreciate it. My email is karim0028@yahoo.com.

Thanks,
JavaDude
Can somebody please tell me how do you register for the programmer certification exam?
Truly aprreciated,
JavaDude
Thanks Paul,
How about if i want to save it as something other than a text file. For instance if i want to save an array in memory so that i can refer back to it again for searching purposes. Would i still use FileReader and FileWriter?
Thankyou in advance,
JavaDude
24 years ago

Originally posted by Paul Wheaton:
How are you storing it in memory? How do you want to store it on disk? (as a text file?)


Yes Paul, i would like to save it as a text file to the harddrive. How would i do this? Please be specific.
Thankyou,
JavaDude
24 years ago
Thanx for the replies,
Yes, Paul. Storing it as a text file would be nice. But, i am too new to programming to know if that is plausabile or even how you would do it. So could you please be more specific.
Thankyou,
JavaDude
24 years ago
I am writing a phonebook database and i am trying to have it save the file to the hardrive or load it from the hard drive. Any suggestions on how i can do this or any known class that can do this would be greatly appreciated.
Thanks in advance,
JavaDude.
24 years ago
i am trying to work on a simple game that resmebles secretsquare. Where it promptst the user for the number of columns and rows he would like to have on the board then it takes that in and creates a two dimensional array based on that and then randomly assigns a secret square. Then it asks him for two coordinates a row and a column and based on that it would tell him how close he is. But, i keep on getting many errors. I will list the code and the errors i keep getting.
CODE:
import java.math.*;
public class SecretSquare{
static int[][] board;
static int a;
static int b;
public void board(int x, int y){ //creates a board
board = new int[x][y];

a = (int) (Math.random() *x); //assigns values to
b = (int) (Math.random() *y); //secret square

int secretsquare = board[a][b];//dont know
} //if syntacticly correct
public void howclose(int k, int l){ //method to check how
if(k==a && l==b) //close
System.out.println("You got it BABY!!!");

if (Math.abs((board[k]- board[a])) == 1&& Math.abs((board[l]- board[b]))== 1)
System.out.println("You are very close!!!");

if (Math.abs((board[k]- board[a])) == 2&& Math.abs((board[l]- board[b])) == 2)
System.out.println("You are close!!");


if (Math.abs((board[k] - board[a])) >= 3)
System.out.println("YOU ARE WAY OFF!!!");


}
public static void main(String[] args){
SecretSquare c = new SecretSquare();
EasyReader stdin = new EasyReader(System.in);
//EasyReader is a way to take input from the user.
System.out.println("SecretSquare is: " + c.secretsquare);
int x = stdin.intQuery("Please indicate the number of columns:");
//stdin.intQuery is a method inside EasyReader that takes asks //the user for an integer input and then uses it in the program.
int y = stdin.intQuery("Please indicate the number of rows: ");
c.board(x, y);
int z = stdin.intQuery("Please enter your guess column: ");
int q = stdin.intQuery("Please enter your guess row: ");
c.howclose(z, q);
}


}
ERRORS WHEN COMPILED:
SecretSquare.java:22: Incompatible type for -. Can't convert int[] to int.
if (Math.abs((board[k]- board[a])) == 1&& Math.abs((board[l]- board[b]))== 1)
^
SecretSquare.java:22: Incompatible type for -. Can't convert int[] to int.
if (Math.abs((board[k]- board[a])) == 1&& Math.abs((board[l]- board[b]))== 1)
^
SecretSquare.java:25: Incompatible type for -. Can't convert int[] to int.
if (Math.abs((board[k]- board[a])) == 2&& Math.abs((board[l]- board[b])) == 2)
^
SecretSquare.java:25: Incompatible type for -. Can't convert int[] to int.
if (Math.abs((board[k]- board[a])) == 2&& Math.abs((board[l]- board[b])) == 2)
^
SecretSquare.java:29: Incompatible type for -. Can't convert int[] to int.
if (Math.abs((board[k] - board[a])) >= 3)
^
SecretSquare.java:37: No variable secretsquare defined in class SecretSquare.
System.out.println("SecretSquare is: " + c.secretsquare);
^
6 errors
END OF ERRORS.

Now these are the errors that i get when i compile. Can somebody please help debug as i am baffeled by these errors. I have tried to fix them, to no avail. If you also have any suggestions on a modification in the code it would be greatly apprectiated.
Thank you in advance,
JavaDude
24 years ago
Hi,
I would like to be able to have a method that adds to an array with an integer that is inputed by the user. And then i would like it to print the number of occurances such as:
add(5);
add(6);
add(5);

then i would like it to print out the number of times the integer occurs in the array for instance:
a[5]= 2;
a[6]= 1;
because 5 was added to the array twice and 6 was added just once.
thankyou in advance,
JavaDude
24 years ago
Hi,
I have been wondering how do you loop through a two dimensional array. It would help if you could show some example such as a two dimentional array that loops through and multiplies each index in the first dimension whith the comparable index in the second dimension.
Thanks in advance,
JavaDude.
24 years ago