Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 (satisfied) 1 21 2 3 Example 2 (not satisfied) 5 2 1 2 7 2. 1 2 1 2. 3 N 2 2 N 1 1 2 1 General Notes: Yourjava code should consist of a single class Your code should use the console to enter the values and not dialogues. The requested values are: Two Integer values Nand M (where N is the number of rows of the matrix and Mis 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) 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 entered N =-5, keep reading Nuntil a positive value is entered. Then proceed to enter M and so on. Assume the user will always enter integer values Do not print anything on the standard output console other than the two requested output words (satisfied and not satisfied), and make sure to print them correctly and the case is sensitive Write directly on VPL moodle (external copy-paste will be prevented and make sure that your code compiles correctly on Moodle without any compilation errors

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

Step: 3

blur-text-image

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago