codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Another 2-D Array question  maig at 23:27 on Sunday, April 30, 2006
 

I'm trying to set a value into a specific location in the Array. So far I have:

/**
* Sets the specified value in a grid at the location specified by the CoordinatePair parameter.
* This method will be invoked on the display grid.
* @param CoordinatePair object containing the coordinates, and the value to put into that
* location as a char.
*/
public void setSpecificCoordinates(CoordinatePair coordsToSet, char valueToSet)
{
coordsToSet = grid[][]; // I realize this is all wrong
vauleToSet =
}

I'm at a total loss as how to do this. The CoordinatePair is a simple class that has accessor methods for row and column and set methods for row and column. I'm not sure how to use CoordinatePair in the class that I am creating now. (which is a 2-D Array)

Any help would be appreciated.

Thanks.
Maig.

<Added>

I have been working on it and I'm a little closer but I'm getting an error at the if statement line...

public void setRandomCoordinates(int numCoordsToSet, char valueToSet)
{
CoordinatePair coords;
int counter = 0;

while (counter < numCoordsToSet)
{
coords=getRandomCoordinates();
if (coords.equals valueToSet) // test if the coordinates already have a target char - error here
{
getRandomCoordinates(); // get new coordinates
}
else
coords=valueToSet; // set the valueToSet into the coordinates
}
}


  Re: Another 2-D Array question  crwood at 02:51 on Monday, May 01, 2006
 


coords.equals valueToSet

should be

coords.equals(valueToSet)

But you cannot test a CoordPair with a char as equals.
You want to get the char at the CoordPair location and test that against the "valueToSet" or see if it is blank or whatever you're interested in.

  Re: Another 2-D Array question  maig at 04:23 on Monday, May 01, 2006
 

Thank you so much!

I was wondering, are there any really good intro to Java tutorials on the web or places to go to learn about it?

I'm using a website called MindLeaders and the previous courses I took were great (HTML, CSS, etc.) but this Java is very hard to understand for me. I have never programmed before.

Thanks!
Maig

  Re: Another 2-D Array question  crwood at 07:22 on Monday, May 01, 2006
 

the java tutorial








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Beginners question on building Bento4 SDK
•  Scrolling Images
•  Re: Please can someone show me how to make a java box pop upand display personal information!
•  Does anyone know to create or implement a diary into Java??
•  jslider - paint track
•  Re: convert minutes into hours and minutes
•  File handle problem
•  Link Capture, help needed
•  Re: java app auto web update..


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007