Week 10

Post date: Nov 15, 2019 6:34:14 PM

Arrays

6.4 Multidimensional arrays

Recommended Self-Test Exercise:

    • p 434: Ex. 23.

Lab Exercises:

  1. Write a program that creates a two dimensional array, fills it using Scanner, then display that array, and then prints the sum and average of every row and column.

  2. Given a two-dimensional array, dataTable, of type double such that the rows can have different lengths. Write a program that computes the average of each row and saves it in a single-dimension array of size corresponding to the rows of dataTable

  3. Write a program that displays the minimum and maximum values and their positions in a 2D array given by the user

  4. Write a program that displays the sum of the elements in Column x of a 2D array (careful with rows of different lengths!)

  5. Write a program that checks to see if a given array is a Latin square. This means that it must be square (suppose it is n x n), and that each row and each column must contain the values 1, 2, ..., n with no duplicated numbers in every row or column.