Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

a. Contact will need instance variables name, relation, bday, phone and email (all of type String). b. Contact will need appropriate methods and constructors. Make

a. Contact will need instance variables name, relation, bday, phone and email (all of type String). b. Contact will need appropriate methods and constructors. Make sure to have a toString() method and have it output a line similar to this: John Carter brother Mar 3 (342) 555-7069 jcarter@carter.com Note that you may have to adjust this method later after seeing the expected program output at the bottom of this document. c. Save this file as Contact.java. 3. You are to create a class called TestContact and save it as TestContact.java. a. Make sure that you create an array called myContacts. Add the following contacts. John Carter brother Mar 3 (342) 555?7069 jcarter@carter.com Elise Carter mom Apr 19 (342) 555?7011 carterMom@carter.com Ellie Carter me Jun 10 (342) 555?8102 ecarter@carter.com Sue Ellen friend Mar 9 (341) 555?9182 susieE@hotmail.com Frank Carter dad Dec 1 (342) 555?7011 carterDad@carter.com Johnnie friend Jan 21 (341) 555?7789 jDawg5555@yahoo.com b. Create a method call printContacts() that traverses through the array and prints out each element. c. Create a method called findByName() that uses a binary search to see if a particular person is in the contact list. You will need an appropriate sorting algorithm. d. Create a method called findByRelation() that uses a sequential search to list all contacts that have a particular relation identify such as friend. e. Create a method called findByBMonth() that uses a sequential search to list all the birthdays for a particular month (hint: you will have to look for substrings). f. Create a method called findByPhone() that uses a sequential search to list all contacts that have a particular phone number. g. Create a method called findByEmail() that uses a binary search to see if a particular email address is in the contact list. You will need an appropriate sorting algorithm. h. Test your method by completing the following searches. Remember that for birthday searches you are actually searching for month (i.e. Mar, May, Apr, etc.).

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

Step: 3

blur-text-image

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

1. The evaluation results can be used to change the program.

Answered: 1 week ago

Question

5. To determine the financial benefits and costs of the program.

Answered: 1 week ago