Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java Complete the method, named findValue, in the class named ArrayOps.java. There are two parameters to this method: the first is an integer array

in java

Complete the method, named findValue, in the class named ArrayOps.java. There are two parameters to this method: the first is an integer array and the second is a integer value.

This method should use a linear search to try to find an instance of the integer value parameter within the array. If the value is in the array, the method returns the subscript of the array where the value was found. If the value is not in the array, the value of the length of the array is returned (as that is a higher value than any of the array subscripts).

Complete the following file:

ArrayOps.java

public class ArrayOps { /** This method performs a linear search on the array identified by the first parameter, while looking for the value indicated by the second parameter. @param values, an array of integers @param valueToFind, an integer to look for in the array values @ return, the index (subscript) of the array where the value was found OR the length of the array if it was not found. */ public static int findValue(int values[], int valueToFind) {

// your work here

} }

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions