Multi-Dimentional Array

Assignment

Write a program that accepts an n x n matrix. The program should also:

1. Total and display the sum of each row and each column

2. Find the product of each row and column

3. Find the highest and lowest value within the array

Constraints

The number of rows and columns should be the same

Use nested for loops and methods

Requirements

Build your matrix based upon user input (e.g., ask how many rows and columns – they must be the same) Use a method to display the matrix (use tabs between each element) Create methods to display the following:

o Method 1: The sum of each row

o Method 2: The sum of each column

o Method 3: The product of each row

o Method 4: The product of each column

o Method 5: The highest value in the matrix

o Method 6: The lowest value in the matrix

Loop the program to run it until the user wishes to exit

In the example below, the numbers ARE NOT hard coded. Your program should ask the user for input

This program should utilize code learned from Week 1 through Week 8 Hints Make sure you use Java coding conventions

Expected Output

The following pages show a sample run with two iterations. User input is in Bold.

Welcome! This program that accepts an n x n matrix, totals the rows and columns & finds the product of each row and column.

Enter number of rows & columns (they will be the same): 2

Enter a value for Row 1, Column 1: 3

Enter a value for Row 1, Column 2: 8

Enter a value for Row 2, Column 1: 7

Enter a value for Row 2, Column 2: 9

The Matrix****************************************

You Entered the Following Matrix:

3 8

7 9

Row Totals****************************************

The sum of row 1 is: 11

The sum of row 2 is: 16

Column Totals*************************************

The sum of column 1 is: 10

The sum of column 2 is: 17

Row Products*************************************

The product of row 1 is: 24

The product of row 2 is: 63

Column Products*************************************

The product of column 1 is: 21

The product of column 2 is: 72

The greatest value in this matrix is: 9

The lowest value in this matrix is: 3

Enter another matrix? (Y or N) y (if yest it loops)

Enter another matrix? (Y or N) n Thank you for using the program! Goodbye!