Array Table assignments

wan Toushiro's Avatar, Join Date: May 2012
Newbie Member
could anyone please help me with this problem? i really need the answer as soon as possible. Thank you.

here is the question:

here is the question :

Write a Java program that

1.queries a user for the number of rows and columns of a contingency table,
2.read the data, row by row and
3.displays the data in tabular form along with the row totals, column totals and grand total.

For example if the six data of 2x3 table are

1,3,6,7,9, and 8. the program displays these six numbers together with the appropriate totals as

1 3 6 | 10
7 9 8 | 24
8 12 14 | 34
The character '|' is used to separate the data from the row totals

here is my code..

Code:
import java.util.Scanner;
    import java.util.*;

public class JavaApplication16 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        
        int numRows;
        int numCols;
        int sizeTable;
        Scanner readinput = new Scanner(System.in);
        
        System.out.println(" Enter the size of table: Rows*Columns " );
        
        numRows = readinput.nextInt();
        numCols = readinput.nextInt();
        
        sizeTable = numRows*numCols;
        
        System.out.println(" The size of table are : "+numRows+"*"+numCols+"="+sizeTable );
        //
        int numData;
        System.out.println(" Enter the data for the table: ");
        numData = readinput.nextInt();
        
        int[][]  ContigencyTable;
        ContigencyTable = new int[numRows][numCols];

Last edited by shabbir; 31May2012 at 08:25.. Reason: Code blocks
wan Toushiro's Avatar, Join Date: May 2012
Newbie Member
anybody could help me?