Question: Write a program that accepts an n x n matrix. The program should also: Total and display the sum of each row and each column

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

Total and display the sum of each row and each column

Find the product of each row and column

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

I'm stuck on the part where the user must input the value of rows and columns. It should look as follows:

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

I understand the first part of this, getting the number of rows and columns. But then getting a value for each row and column from the user is where I'm getting stuck.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!