PDA

View Full Version : [Java]Matrix Arrays


Lax2006
12-15-2006, 06:07 AM
I'm doing a program in my Java class that I just need a tad bit of help with, I need to get the matrix arrays to get the data the right way...currently my program (without the print function)

import javax.swing.*;

public class matrixArray {

public static void main( String args[] )
{
int testScores[][] = new int[ 3 ][ 3 ];

fillScores( testScores );

System.exit( 0 );
}

public static void fillScores( int[][] ftestScores )
{
for( int row = 0; row < ftestScores.length; row++ )
{
for( int column = 0; column < ftestScores[ row ].length; column++ )
// I'm using Input dialog boxes to retrieve the data from the user and I'm wondering how I will put the data into the arrays

}

}

}

_Aerospace_Eng_
12-15-2006, 06:16 AM
Someone needs to read their book a little more carefully. This is the JavaScript forum NOT Java.

As for your problem well you already have var row. Since this is an assignment I won't give you the exact answer. Just think about the indexes of the array cells. What could you use to access each cell? Remember array indexes start at 0.

Lax2006
12-15-2006, 09:08 PM
Oh, sorry. Thanks, I figured out what to do during my Java class today, now I'm just doing the average of the 3 numbers that are in the matrix array.