Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would like some help in completing this exercise. Thank You public class ContactManager { /** * The instance variables are given below. Do NOT

I would like some help in completing this exercise. Thank You

public class ContactManager { /** * The instance variables are given below. Do NOT modify the two lines * */ private int nContacts; private Contact[] contacts;

/** * Implement the constructor of ContactManager class. In the constructor, * allocate an array of Contact. Use the nMaxContact as the length of the array * Initialize the nContacts to 0 in the constructor. * */ public ContactManager(int nMaxContact) { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }

/** * Given 4 String parameters, add a contact to the contacts array. Before adding * a contact to the array, do a parameter sanity check in this method. If the * array is full, or if first name or last name is null or an empty string, do * not add a contact but return false instead. Middle name can be left as null * or an empty String. Note that we allow adding duplicate contacts. * * If the name is acceptable, create a new contact and add the phone number to * the contact by calling the addPhoneNumber method of the Contact object. If * the method returns false, do not add the contact to the array and return * false (i.e., we discard the contact instantiated.) Otherwise, add the contact * to the array and return true. * * @param fName * @param lName * @param mName * @param phoneNumber * * @return a boolean value. See the description above */ public boolean addContact(String fName, String lName, String mName, String phoneNumber) { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }

/** * Given a Contact object, return the number of contacts with the identical name * (i.e., they have identical first, last, and middle name. If the input * parameter is null, return -1. * * For example, if the contacts array contains 10 contacts and there are 3 * elements have the same name, return 3. * * @return an int value. See the description above. */ public int countEqualContacts(Contact c) { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); }

/** * This method returns the number of contacts (int) */ public int countContacts() { throw new UnsupportedOperationException("Remove this line and replace with your implementation."); } }

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

2. Define identity.

Answered: 1 week ago

Question

1. Identify three communication approaches to identity.

Answered: 1 week ago

Question

4. Describe phases of majority identity development.

Answered: 1 week ago