I am looking to try and see if I can get a concurrent program running as I never have done so before and I am currently in a place with 10 computers on a network to try a program out on. So could someone convert this program that I have been working on(below) to be run concurrently using multithreaded
java or show me another concurrent program so I can
test out whether it works here, so I can start writing some myself.
Thanks
-----------------------------------------------------------------------------
import java.io.*;
class PrintMatrix
{
public static void main(
String[ ] args)
{
PrintMatrix theApp = new PrintMatrix();
theApp.run();
}
private void run()
{
int[][] b = new int[5][5];
int[] sum = new int[5];
int total = 0;
//Get the info
for(int i = 0; i < b.length; i++ )
{
System.out.println("Enter data for Column " + (i+1));
for (int j = 0; j < b[i].length; j++ )
{
sum[i] += b[i][j] = getInt();
}
total += sum[i];
}
//Print the info
for(int i = 0; i < b.length; i++ )
{
for (int j = 0; j < b[i].length; j++ )
{
System.out.print(b[j][i] + "\t");
}
System.out.println();
}
//Print the sums
for(int i = 0; i < sum.length; i++){
System.out.print(sum[i] + "\t");
}
System.out.println("Total: " + total);
}
private int getInt()
{
int num;
String inStr = null;
try
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter integer data: ");
inStr = in.readLine();
}
catch(IOException ioe)
{
System.out.println(ioe);
}
num = Integer.parseInt(inStr);
return num;
}
}
[ January 08, 2004: Message edited by: David Hunt ]