ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 12 Weeks Ago, 6 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 02 May 2017 My Price 8.00

Linear Search Write a Java program

Linear Search

Write a Java program, called SearchArray that contains a static method called countStrings() that accepts a 2D array of Strings and a String as its parameters. The method should return an integer value that is the total number of times the String being searched for is contained in the 2D String array. The array and search value should be taken in using user input in the main method. You should print an appropriate message to the screen if the element is found and how many times it exists in the array. Note: The countStrings() method should work irrespective of case.

Input

n 

mij mij+1 mij+2 .... mij+n

mi+1j mi+1j+1 mi+1j+2 .... mi+1j+n 

mi+nj mi+nj+1 mi+nj+2 .... mi+nj+n

x 

where n is the size of the square array, mi is an element in the array and x is the element that is being searched for. 

Sample input 1

3

cat dog dUck

rabbit hen duCk

dUcK DucK goose

Duck

Sample input 2

4

Volvo Fiat Suzuki Toyota

fiat Suzuki Volvo Ferrari

Ferrari Porsche Lamborghini Jag

Jag Fiat Citroen Toyota

Opel

Output

A message stating if the element is found.

Sample output 1

 Duck is contained 4 times in the array

Sample output 2

 Opel was NOT found in the array

Answers

(11)
Status NEW Posted 02 May 2017 09:05 AM My Price 8.00

-----------

Not Rated(0)