I am working on a question from a
Java tutorial website(as I am trying to learn Java myself) could someone give me help on the following:
Whats Required:
Sequential program that receives as input a single Y x Z dimensional matrix (A) with a large amount of unsorted integer numbers(Created randomly).
The program then has to produce an N-dimensional array B containing the sum of the numbers in each A column(for example Bi = Ai1 + Ai2 + etc + AiN
(i = 1 .....M)
so the output I think would be as follows from what I understand from the question:
If the user entered 5,5:
3 2 2 4 8
1 4 2 3 7
2 4 7 2 6
2 5 1 7 9
1 2 8 3 4
9 17 20 19 34 << Columns added together
The only code I have came up with so far is(which as you can probably see is just the skeleton of the code):
import java.io.*;
public class Matrix
{
public static void main(
String[ ] args)
{
Matrix theApp = new Matrix();
theApp.run();
}
private void run()
{
// Code to generate a number of random numbers (depending on user input)
// Adding the columns together and printing to screen grid
}
Could someone help me implement the missing code please.
Thanks for any help.