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 (0-9) entered (row

image text in transcribed

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 (0-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) Example 2 (not satisfied) 5 2 1 2 1 3 N 2 2 7 2. 1 2 1 1 1 2 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 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 N until a positive value is entered. Then proceed to enter Mand 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 moodiq (external copy paste will be prevented and make sure that your code compiles correctly on Moodle without any compilation errors VPL

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

Students also viewed these Databases questions

Question

13. You always should try to make a good first impression.

Answered: 1 week ago