Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an application named SquareMatrixCenter whose main method asks the user to enter an integer number n (between 2 and 10), and an n by

Create an application named SquareMatrixCenter whose main method asks the user to enter an integer number n (between 2 and 10), and an n by n integer matrix then passes the matrix with the values entered by the user to the following method:

static void printMatrixCenter(int [][] matrix): prints the square matrix at the center of the given matrix, that is all the numbers of the given matrix except those on the first and last row, and first and last column.

Use the Scanner class to read the users input.

Example 1.

Input:

Please enter an integer between 2 and 10: 4

Please enter a 4 by 4 matrix:

5 7 7 8

12 0 -5 15

3 12 9 10

7 3 8 7

Output:

The center of the matrix is :

0 -5

12 9

Example 2.

Input:

Please enter an integer between 2 and 10: 6

Please enter a 6 by 6 matrix:

5 7 7 8 6 8

12 0 -5 15 5 0

3 12 9 10 1 3

7 3 8 7 2 7

0 6 -7 8 1 12

1 1 2 6 9 10

Output:

The center of the matrix is :

0 -5 15 5

12 9 10 1

3 8 7 2

6 -7 8 1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

Students also viewed these Databases questions