Go4Expert (http://www.go4expert.com/)
-   Java (http://www.go4expert.com/forums/java/)
-   -   Array Table assignments (http://www.go4expert.com/forums/array-table-assignments-t28487/)

wan Toushiro 31May2012 00:20

Array Table assignments
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..


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];

wan Toushiro 31May2012 01:48

Re: Array Table assignments
anybody could help me?

All times are GMT +5.5. The time now is 07:20.