Create a class called Contact a. Contact will need instance variables name, relation, bday, phone and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a class called Contact 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 Elise Carter Ellie Carter Sue Ellen Frank Carter Johnnie brother Mar 3 Apr 19 Jun 10 Mar 9 mom me friend dad friend (342) 555-7069 (342) 555-7011 jcarter@carter.com carterMom@carter.com ecarter@carter.com susieE@hotmail.com Dec 1 (342) 555-7011 carterDad@carter.com Jan 21 (341) 555-7789jDawg5555@yahoo.com (342) 555-8102 (341) 555-9182 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). Create a method called findByPhone () that uses a sequential search to list all contacts that have a particular phone number. f. 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.). Options Name Johnnie Name - Sam Parker Relation - friend Relation - Aunt Name Phone - (333) 555-8989 Phone - (342) 555-7011 Bday - May Bday - Mar Email - rgoodman@hotmail.com Email - susieE@hotmail.com BlueJ: Terminal Window - demo Your output should be similar to below: John Carter Elise Carter Ellie Carter Sue Ellen Frank Carter Johnnie Relation brother mom me friend dad friend Find Name - Johnnie Found: Johnnie Contact List friend. Birthday Mar 3 Apr 19 Jun 10 Mar 9 Dec 1 Jan 21 Jan 21 Phone Email (342) 555-8102 (342) 555-7069 jcarter@carter.com (342) 555-7011 carterMom@carter.com ecarter@carter.com (341) 555-9182 susieE@hotmail.com (342) 555-7011 carterDad@carter.com (341) 555-7789 jDawg5555@yahoo.com (341) 555-7789 jDawg5555@yahoo.com X BlueJ: Terminal Window - demo Options Find Bday Mar Find results: John Carter Sue Ellen There were 2 listings for Mar brother friend Find Email rgoodman@hotmail.com Not found. Find EmailsusieE@hotmail.com Found: Sue Ellen Mar 3 Mar 9. friend Mar 9 (342) 555-7069 jcarter@carter.com (341) 555-9182 susieE@hotmail.com n (341) 555-9182 susieE@hotmail.com X E Create a class called Contact 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 Elise Carter Ellie Carter Sue Ellen Frank Carter Johnnie brother Mar 3 Apr 19 Jun 10 Mar 9 mom me friend dad friend (342) 555-7069 (342) 555-7011 jcarter@carter.com carterMom@carter.com ecarter@carter.com susieE@hotmail.com Dec 1 (342) 555-7011 carterDad@carter.com Jan 21 (341) 555-7789jDawg5555@yahoo.com (342) 555-8102 (341) 555-9182 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). Create a method called findByPhone () that uses a sequential search to list all contacts that have a particular phone number. f. 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.). Options Name Johnnie Name - Sam Parker Relation - friend Relation - Aunt Name Phone - (333) 555-8989 Phone - (342) 555-7011 Bday - May Bday - Mar Email - rgoodman@hotmail.com Email - susieE@hotmail.com BlueJ: Terminal Window - demo Your output should be similar to below: John Carter Elise Carter Ellie Carter Sue Ellen Frank Carter Johnnie Relation brother mom me friend dad friend Find Name - Johnnie Found: Johnnie Contact List friend. Birthday Mar 3 Apr 19 Jun 10 Mar 9 Dec 1 Jan 21 Jan 21 Phone Email (342) 555-8102 (342) 555-7069 jcarter@carter.com (342) 555-7011 carterMom@carter.com ecarter@carter.com (341) 555-9182 susieE@hotmail.com (342) 555-7011 carterDad@carter.com (341) 555-7789 jDawg5555@yahoo.com (341) 555-7789 jDawg5555@yahoo.com X BlueJ: Terminal Window - demo Options Find Bday Mar Find results: John Carter Sue Ellen There were 2 listings for Mar brother friend Find Email rgoodman@hotmail.com Not found. Find EmailsusieE@hotmail.com Found: Sue Ellen Mar 3 Mar 9. friend Mar 9 (342) 555-7069 jcarter@carter.com (341) 555-9182 susieE@hotmail.com n (341) 555-9182 susieE@hotmail.com X E
Expert Answer:
Related Book For
Intermediate Accounting
ISBN: 978-1260481952
10th edition
Authors: J. David Spiceland, James Sepe, Mark Nelson, Wayne Thomas
Posted Date:
Students also viewed these programming questions
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Use trigonometry/parallelogram law to determine the resultant force (magnitude and direction from the positive x-axis) of the two forces. Lunits units 30 Problem 1/2 27 units
-
Ontario Traveller Magazine completed the following transactions during 2014: Aug. 31 Sold one-year subscriptions, collecting cash of $1,500, plus HST of 13%. Dec. 31 Remitted (paid) HST to Canada...
-
For any vector operator V one can define raising and lowering operators as (a) Using Equation 6.33, show that (b) Show that, if is an eigenstate of L 2 and L z with eigenvalues (+1) 2 and ...
-
State the appropriate null and alternate hypotheses for determining whether to conclude that the failure rates differ among the four lines. Exercises 49 refer to the following data: Electric motors...
-
The Village of Seaside Pines prepared the following enterprise fund Trial Balance as of December 31, 2017, the last day of its fiscal year. The enterprise fund was established this year through a...
-
Research Paper Outline Introduction 1)Non-Compete Agreements- define what is a non compete agreement, history, and why they were created 2) When are these agreements enforceable i.e. definition and...
-
You are working at a Trident Steel, a steel solution provider that manufactures steel for several industries, including construction, mining, and automotive industries. One of your immediate tasks is...
-
Which of the "Big Five" personality traits listed in the e-book do you possess? How, specifically, will the personality traits you possess lead to making you a better leader? (I'm looking for very...
-
Kingsport Containers Company makes a single product with wide seasonal variations in demand. The company uses a job-order costing system and computes plantwide predetermined overhead rates on a...
-
1.Which question should the nurse ask in order to judge the validity of a research study? a.What reliability information has been provided? b.Are the instrument measures applied consistently? c.Does...
-
Problem 4.6 (20 Points) Amazon is on a mission to be net zero carbon by 2040. As part of that endeavor they are considering using autonomous delivery vehicles which operate on alternative power...
-
Two point charges are positioned in the x-y plane as shown in the figure: y (mm) 90 80 70 60 50 40 30 20 10 Q2 Q1 0 10 20 30 40 50 60 70 80 90 x (mm) The point charges have the following values: Q =...
-
Recording and Determining Financial Statement Effect of Accounting Change Gear Company records $2,000 of depreciation under the sum-of-years'-digits method in Year 9, the company's first year of...
-
Given the matrices can the operation BC be performed? Choose B [4 2 01 0 0 3 " -4 -4 = [31] C= - 4
-
Bonus shares can be issued out of revenue reserves. True/False?
-
You recently joined the auditing staff of Best, Best, and Krug, CPAs. You have been assigned to the audit of Clearview, Inc., and have been asked by the audit senior to examine the balance sheet...
-
Refer to the situation described in BE 10-12. Answer the questions assuming that the exchange lacks commercial substance.
-
Distinguish between operating and nonoperating income. Cite examples of items that are typically included in each category.
-
What material is contained in a Statement of Auditing Standards?
-
What are the rules on sending out accounts in summary form?
-
What documents are issued by the APB?
Study smarter with the SolutionInn App