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
-
On March 31, 2014, JetHapppy Airways purchased a used Boeing jet at a cost of $40,000,000. JetHappy expects to fly the plane for six years and expects it to have a residual value of $4,000,000....
-
This method is specified in the Statement interface, and should be used to execute an INSERT statement. a. Execute b. ExecuteUpdate c. ExecuteQuery d. ExecuteSelect
-
A U.S. Treasury bond pays a 7% coupon on January 7 and July 7. How much interest accrues per \($100\) of principal to the bond holder between July 7, 2013, and August 9, 2013? How would your answer...
-
Weston Products manufactures an industrial cleaning compound that goes through three processing departmentsGrinding, Mixing, and Cooking. All raw materials are introduced at the start of work in the...
-
Research Web-based database technologies and identify a database management system (other than SQL Server, MySQL, or Oracle) that is used to deploy applications to the Web and the cloud. Discuss the...
-
The MFG Corporation is planning to produce and market three different products. Let x1, x2, and x3 denote the number of units of the three respective products to be produced. The preliminary...
-
The following is a comparative statement of financial position and income statement for Bramble Corporation: Assets Cash Bramble Corporation Balance Sheet As at September 30 Accounts receivable...
-
What importance does the responsibilities of HR Departments do to a company? Explain
-
What are some ideas for your social media strategy and how you will engage the mainstream media for an communication and advocacy for addressing the opioid crisis particularly the fentanyl overdose...
-
Match the following CSBs Question 4 options: but you must still report this income until the bond matures or you cash it in. report the amount shown on the T5 slips. until you cash it in. 1. Interest...
-
1. What are the prime goals of leadership development? 2. What role does a trend in healthcare professional supply play in the process of job analysis?
-
write a argumentative essay making a claim or claims going against the benefits of a healthy lifestyle community is really all about self care. the argument will include support from at least two of...
-
Presented below are data for Blossom Company 2020 2021 Assets, January 1 $8840 $9710 Liabilities, January 1 4850 ? Stockholders' Equity, Jan. 1 Dividends 1610 1205 Common Stock 1448 1286...
-
The test statistic in the NeymanPearson Lemma and the likelihood ratio test statistic K are intimately related. Consider testing H 0 : = 0 versus H a : = a , and let * denote the test statistic...
-
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.
-
Consider the data file \(m r o z\) on working wives. Use the 428 observations on married women who participate in the labor force. In this exercise, we examine the effectiveness of a parent's college...
-
Consider the data file \(m r o z\) on working wives. Use the 428 observations on married women who participate in the labor force. In this exercise, we examine the effectiveness of a parent's college...
-
The CAPM says that the risk premium on security \(j\) is related to the risk premium on the market portfolio. That is where \(r_{j}\) and \(r_{f}\) are the returns to security \(j\) and the risk-free...
Study smarter with the SolutionInn App