Question: In JAVA (simplest) form... noting complicated! sperate one an 2! Search Array: The linear search approach compares the key element key sequentially with each element

In JAVA (simplest) form... noting complicated! sperate one an 2!
Search Array: The linear search approach compares the key element key sequentially with each element in the array. It continues to do so until the key matches an element in the array or the array is exhausted without a match being found. If a match is made, the linear search returns the index of the element in the array that matches the key. If no match is found, the search returns -1. public static int linear Search(int[] list, int key) Write the following method that takes an array of integers and a key value. The method search for key if the array contains the key, methods must return the index of key otherwise it must return-1. Write a test program that do the following; 1. create an array of integer with the size 100 2. fill array with randomly generated number between 0-50 3. prompt user to enter number between 0-50, and search the array for that number by using 4. 2 2 (Pattern recognition consecutive four equal numbers) Write the following method that tests whether the array has five consecutive numbers with the same value. public static boolean isConsecutiveFour(int[] values) Write a test program that prompts the user to enter a series of integers and displays if the series contains four consecutive numbers with the same value. Your program should first prompt the user to enter the input sizei.e., the number of values in the series. Here are sample runs: Enter the number of values: 8 Enter Enter the values: 3 4 5 5 5 5 4 5 wtreer The list has consecutive fours Enter the number of values: 9 enter Enter the values: 3 4 5 5 6 5 5 4 5 The list has no consecutive fours
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
