Java: An Introduction to Problem Solving and Programming (7th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
7th Edition
ISBN: 9780133766264
Author: Walter Savitch
Publisher: PEARSON
bartleby

Videos

Textbook Question
Book Icon
Chapter 7, Problem 20E

Write a static method findFigure (picture, threshold), where picture is a two-dimensional array of double values. The method should return a new two-dimensional array whose elements are either 0.0 or 1.0. Each 1.0 in this new array indicates that the corresponding value in picture exceeds threshold times the average of all values in picture. Other elements in the new array are 0.0.

For example, if the values in picture are

Chapter 7, Problem 20E, Write a static method findFigure (picture, threshold), where picture is a two-dimensional array of , example  1

the average value is 5 55 The resulting array for a threshold of 1 4 would be

Chapter 7, Problem 20E, Write a static method findFigure (picture, threshold), where picture is a two-dimensional array of , example  2

and the resulting array for a threshold of 0 6 would be

Chapter 7, Problem 20E, Write a static method findFigure (picture, threshold), where picture is a two-dimensional array of , example  3

Blurred answer
Students have asked these similar questions
Write a method that takes a two-dimensional array of type int and returns no value. The method replaces every positive element in the taken array with 0. Array before invoking the method Array after invoking the method 14 1 13 17 -5 5 -2 30 -63 -8 -10 78 4 0. -3 0 -5-5 0 -2 0 -6 3-8 0. -1 0 -4 0 10 5 10 -2-2 3 5 -7 8 0. 0 0 -2 -2 3 00 -7 0. -1 Paragraph B. 1. public static void handleTwoDArray(int[]0 in) (
Write a method that takes two arrays as parameters. It should return a new array where each position has the sum of the two corresponding positions in the two incoming arrays. The returned array should be as long as the longer of the two passed in arrays.
Four integers are read from input and stored into the array arrayToModify. Write a static method resetFirstValue() that takes an integer array parameter and replaces the first element with 1. Ex: If the input is 55 45 70 65, then the output is: Original array: 55 45 70 65 Changed array: 1 45 70 65 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35     Scannerscnr=newScanner(System.in); finalintNUM_ELEM=4; int[] arrayToModify=newint[NUM_ELEM]; inti; intuserNum;   for (i=0; i<arrayToModify.length; ++i) { arrayToModify[i] =scnr.nextInt(); }   System.out.print("Original array: "); printArr(arrayToModify);   resetFirstValue(arrayToModify);   System.out.print("Changed array: "); printArr(arrayToModify); } }

Chapter 7 Solutions

Java: An Introduction to Problem Solving and Programming (7th Edition)

Ch. 7.2 - Give the definition of a static method called...Ch. 7.2 - Prob. 12STQCh. 7.2 - The following method compiles and executes but...Ch. 7.2 - Suppose that we add the following method to the...Ch. 7.3 - Prob. 15STQCh. 7.3 - Replace the last loop in Listing 7.8 with a loop...Ch. 7.3 - Suppose a is an array of values of type double....Ch. 7.3 - Suppose a is an array of values of type double...Ch. 7.3 - Prob. 19STQCh. 7.3 - Consider the partially filled array a from...Ch. 7.3 - Repeat the previous question, but this time assume...Ch. 7.3 - Write an accessor method getEntryArray for the...Ch. 7.4 - Prob. 23STQCh. 7.4 - Write the invocation of the method selectionSort...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - How would you need to change the method...Ch. 7.4 - Consider an array b of int values in which a value...Ch. 7.5 - What output is produced by the following code?...Ch. 7.5 - Revise the method showTable in Listing 7.13 so...Ch. 7.5 - Write code that will fill the following array a...Ch. 7.5 - Write a void method called display such that the...Ch. 7.6 - Prob. 33STQCh. 7 - Write a program in a class NumberAboveAverage that...Ch. 7 - Write a program in a class CountFamiles that...Ch. 7 - Write a program in a class CountPoor that counts...Ch. 7 - Write a program in a class FlowerCounter that...Ch. 7 - Write a program in a class characterFrequency that...Ch. 7 - Create a class Ledger that will record the sales...Ch. 7 - Define the following methods for the class Ledger,...Ch. 7 - Write a static method isStrictlyIncreasing (double...Ch. 7 - Write a static method removeDuplicates(Character[]...Ch. 7 - Write a static method remove {int v, int [] in}...Ch. 7 - Suppose that we are selling boxes of candy for a...Ch. 7 - Create a class polynomial that is used to evaluate...Ch. 7 - Write a method beyond LastEntry (position) for the...Ch. 7 - Revise the class OneWayNoRepeatsList, as given in...Ch. 7 - Write a static method for selection sort that will...Ch. 7 - Overload the method selectionSort in Listing 7.10...Ch. 7 - Revise the method selectionSort that appears in...Ch. 7 - Prob. 18ECh. 7 - Write a sequential search of an array of integers,...Ch. 7 - Write a static method findFigure (picture,...Ch. 7 - Write a static method blur (double [] [] picture)...Ch. 7 - Write a program that reads integers, one per line,...Ch. 7 - The following code creates a small phone book. An...Ch. 7 - Write the method rotateRight that takes an array...Ch. 7 - The following code creates a ragged 2D array. The...Ch. 7 - Write a program that will read a line of text that...Ch. 7 - Prob. 2PPCh. 7 - Add a method bubbleSort to the class ArraySorter,...Ch. 7 - Add a method insertionSort to the class...Ch. 7 - The class TimeBook in Listing 7.14 is not really...Ch. 7 - Define a class called TicTacToe. An object of type...Ch. 7 - Repeat Programming Project 10 from Chapter 5 but...Ch. 7 - Prob. 8PPCh. 7 - Write a GUI application that displays a picture of...Ch. 7 - ELIZA was a program written in 1966 that parodied...Ch. 7 - Prob. 11PPCh. 7 - Create a GUI application that draws the following...Ch. 7 - Practice Program 2 used two arrays to implement a...Ch. 7 - Practice Program 5.4 asked you to define Trivia...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License