subject

Write a method public static void printRuns (int [] [] values, int runLength) that takes a 2D array of integers and prints out which rows and columns (and/or parts of rows and columns) contain runs of length runLength. A run is a group of identical consecutive values. For example 7, 7, 7is a run of length 3. Each print-out must clearly indicate which part of a row or column contains the run. The example method call outputs given below will help to clarify what the method does and what its output should be. In the output, assume that the row and column numbering begins at 0, not 1. You may assume that the values array is rectangular (i. e., not ragged) For the examples below, suppose we have the following 2D array: int [] [ = new int [] [] { nums2D 5, 5, 0, 5, 2}, 1, 2, 2, 2, 2}, 2, 4, 2, 2, 2}, 2, 2, 2, 2, 2}, 3, 3, 2, 2, 2}, {4, 4, 2, 2, 0}, 4, 2, 2, 2, 8}};
Method call: printRuns (nums2D, 4);
Expected output:
Row 1, columns 1 - 4
Row 3, columns 0 - 3
Row 3, columns 1 - 4
Column 2, rows 1 4
Column 2,
Column 2, 5 rows 2 rows 3
Column 3, rows 1
Column 3, 5 rows 2
Column 3, rows 3 - 6
Column 4, 3 rows 0
Column 4 rows 1- 4
Method call: printRuns (nums2D, 5)
Expected output:
Row 3, columns 0
Column 2, 5 rows 1
Column 2, 6 rows 2
Column 3, 5 rows 1
Column 3, rows 2
Column 4, rows 0- 4
Method call: printRuns (nums2D, 6); Ln 4Ln LO LO
Expected output:
Column 2, rows 1 - 6
Column 3, rows 1 - 6
Method call: printRuns (nums 2D, 7);
Expected output:
(no output

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 08:00, dramaqueenactr2040
Two technicians are discussing the common u-joint. technician a says its input and output speeds should be equal. technician b says that it normally has two yokes. which technician is correct?
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, JeroMii
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
image
Computers and Technology, 23.06.2019 02:00, rah45
Which of the following is not a source of sustainable raw materials? a) coal mine b) flick of sheep c) cotton plantation d) line forest.
Answers: 2
image
Computers and Technology, 23.06.2019 02:00, magicalunicorns47
Arecipients list has been loaded into a document. which commands should be clicked in order to filter the list so that letters will not be printed for recipients who live in a certain state? mailings tab, start mail merge, select recipients, type new list, then insert only contacts from the desired states mailings tab, rules, select recipients, use existing list, then choose a recipients list that includes only contacts in certain states mailings tab, select recipients, use existing list, rules, fill in, then type in certain states mailings tab, rules, skip record select “state” under field name, then type in the state name under “equal to”
Answers: 2
You know the right answer?
Write a method public static void printRuns (int [] [] values, int runLength) that takes a 2D array...

Questions in other subjects: