Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

Just follow the instructions!

Just follow the instructions!.

I don’t know how to handle this Computer Science question and need guidance.

  1. SUMMARY
  1. Adjust the code we did in class to do a recursive binary search on a sorted array of Strings instead of integers.
  1. This lab will involve the following new features:
    1. Recursion
    2. Binary Search Algorithm
  1. DETAILS
  1. These instructions will be more bare than usual since the source code from class is being provided and I want you to think through all the changes you need to make.
  1. Set up your String array.
    1. Instead of having a “for” loop populating your array with random numbers, go ahead and make your array 10 in length and populate it in 10 lines of code that put a different string in each array slot, such as:

asWords[0] = “Frank”;

  1. Change all references to the array and any references pulling values from the array to String type instead of int type.
  1. Adjustment to binary search method.
    1. Besides figuring out which things have to now become String type, you need to compare the string values a bit different than the integers by using the “equals” and “compareTo” methods.
      1. Example for equals check:
        1. Instead of…
          1. iTarget == …
        2. It’s this…
          1. sTarget.equals(…)
      2. Example for greater than check:
        1. Instead of…
          1. iTarget > …
        2. It’s this…
          1. sTarget.compareTo(…) > 0
            1. The reason you are seeing if the comparison is greater than 0 is because the “compareTo” method returns a number greater than 0 if sTarget is greater than the string that’s passed in the parentheses. If it’s equal, it returns 0 (but that won’t happen because the equals comparison was in the first if statement). And if it’s less than, it returns a number less than 0.
  1. You can remove, comment out, or update the traditional search method at the bottom of the code. It’s up to you.

Just follow the instructions!