Answer to Question #331747 in Java | JSP | JSF for stephanie

Question #331747

Write a program that has these overloaded search methods to do array searching:


boolean search(int[] arr, int searchKey) – searches an integer array given a search key value, returns true if searchKey is found, false if not.


Hint:

boolean found=false;

for(int i=0; i<arr.length; i++){

   if(    ){//compare the array element with the search key value

      //action taken if found

   }

}

//return something


boolean search(String[] arr, String searchKey) – searches an array of strings given a search key value, returns true if searchKey is found, false if not.

(read Comparing_Strings.doc)


In the main method, you can declare and initialize the two arrays with random values, for example:

int[] intArray={7,3,2,8,1,0,9};

String strArray={"Enchanted","Bedazzled","Divine","Delighted","Elegant"};


Use the methods in the program.




0
Service report
It's been a while since this question is posted here. Still, the answer hasn't been got. Consider converting this question to a fully qualified assignment, and we will try to assist. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS