Recall that Programming Exercise 7 in Chapter 8 asked you to design a program with two parallel
Question:
Recall that Programming Exercise 7 in Chapter 8 asked you to design a program with two parallel arrays: a String array named people and a String array named phone Numbers. The program allows you to search for a person’s name in the people array. If the name is found, it displays that person’s phone number. Modify the program so it uses the binary search algorithm instead of the sequential search algorithm.
Programming Exercise 7
Design a program that has two parallel arrays: a String array named people that is initialized with the names of seven of your friends, and a String array named phoneNumbers that is initialized with your friends’ phone numbers. The program should allow the user to enter a person’s name (or part of a person’s name). It should then search for that person in the people array. If the person is found, it should get that person’s phone number from the phoneNumbers array and display it. If the person is not found in the people array, the program should display a message indicating so.
Step by Step Answer: