Question: Write a java program to do the following: 1. Declare an integer matrix of size NxM, which will be filled with digits (1-9) entered (row

 Write a java program to do the following: 1. Declare aninteger matrix of size NxM, which will be filled with digits (1-9)

Write a java program to do the following: 1. Declare an integer matrix of size NxM, which will be filled with digits (1-9) entered (row by row) by the user by using the standard input console (not input dialog). 2. Check if the integer matrix satisfies the following condition: 1. For each cell A in the matrix, check if the count of adjacent cells is strictly greater than the value written in cell A. If this condition is satisfied, then print (satisfied), otherwise print (not satisfied) 2. Adjacent cell means [left, right, up, down] (see figure below) 3. Special cases: 1. Corner cells have only 2 adjacent cells 2. Border cells have only 3 adjacent cells border corner inner Example: N = 3 and M = 3 Example 1 (satisfie 1 2. 1 2 3 2 1 2 1 General Notes: Your java code should consist of a single class . Your code should use the console to enter the values and not dialogues. The requested values are: o Two integer values N and M (where N is the number of rows of the matrix and M is the number of columns). Those two values should be strictly greater than zero o NxM integers which are digits. The values should be strictly between 1 and 9 (inclusive) o Make sure that entered values are valid. In case the user enters invalid input, you should keep reading this particular value until a valid value is entered. for example: if the user ente N = -5, keep reading N until a positive value is entered. Then proceed to enter M and so on

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!