Question: 2. The following code creates a small phone book. An array is used to store a list of names and another array is used to

image text in transcribed

2. The following code creates a small phone book. An array is used to store a list of names and another array is used to store the phone numbers that go with each name. For example, Michael Myers' phone number is 333-8000 and Ash Williams' phone number is 333-2323 Write the method 1ookupName so the code properly looks up and returns the phone number for the input target name. lookupName should return a blank string if the name is not in the phone book Scanner kbdnew Scanner (System. in); String[] names "Michael Myers", "Ash Williams" , "Jack Torrance", "Freddy Krueger") "333-8000", "333-2323", "333-6150", "339-7970" String[] phoneNumbers System.out.println("Enter name to look up.") String targetName kbd.nextLine () String targetPhone1ookupName (targetName, names, phoneNumbers); System.out.println("The phone number is"targetPhone); Programming Project 13 asks you to rewrite this program using an array of a single object. The object-based approach is more scalable than this approach, which requires a separate array to be managed for every property of the phone contact. Image_C7PP13_1.pdf C file:///C:/Users/abdul/Downloads/lmage_C7PP13.1.pdf 13. Practice Program 2 used two arrays to implement a simple phone book.A more scalable solution is to make an array of an object that stoi name single array of an object. The output should remain the same. es the and corresponding phone number. Modify the program to use a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!