Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions: For this assignment, you will implement the sequential and binary search algorithms on a collection of contacts. 1. Create a new project called 08.03

Instructions: For this assignment, you will implement the sequential and binary search algorithms on a collection of contacts.

1. Create a new project called 08.03 Assignment in your Module 08 assignments folder.

2. Create an implementation class to define an entry within a contacts list.

a. Establish instance variables for the entry's name, relation to you, birthday, phone number, and email address.

b. Set up a constructor for a contact entry that will initialize all the instance variables.

c. Create appropriate methods, including a toString method that returns a String with all of a contacts information.

d. Add any additional attributes or behaviors you feel are appropriate (optional).

3. For this project, you will create a tester class that declares an array of people within your contact list, and makes use of methods to search the data.

4. Declare an array of at least 10 people in a contacts list. Please do not use real phone numbers, birthdates, or email addresses. Be sure to have some repeated values, such as a relationship to you and birth months.

For example: Diana Prince, aunt, Oct 25, 321-555-0811, wonderwoman@theamazon.net

5. Design a static method that traverses through the array and prints all the contacts in a table format.

6. Since the data will need to be sorted prior to conducting a binary search, create sort methods for name and relationship values.

a. You may use the insertion, selection, or merge sort, but not a bubble sort.

b. Name and document the methods to clearly indicate the type of sort and the values being sorted.

c. Utilize print debugging statements to ensure the sorts worked. Be sure to comment these out prior to submitting your work.

7. Create the following static methods in the tester class. Utilize the sequential and binary search algorithms as indicated.

a. a binary search method that searches the array for a particular name

b. a binary search method that searches the array for a relationship. The output should list all contacts with the same relationship, such as friend or aunt. Create a linearPrint method to assist in finding all occurrences

c. a sequential search method that searches the array for all birthdays in the specified month. Hint, substrings will help you when looking for matches

d. a sequential search method that searches the array for all contacts with the same phone number

e. a sequential search method that searches the array for all instances of a particular email address

8. Test your search methods by calling each and displaying the results. Start by showing the original array. Then demonstrate searching for a name; showing results when a name is found and when not found. Do the same for each of the other types of values associated with a contact. Include searches that should find more than one match. Remember, for birthday searches you are actually searching for month (i.e. Mar, May, Apr, etc.). Be sure to clearly label your output so someone looking at it knows which search criterion was applied each time.

By the way, I'm learing Java through the BlueJ.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago