Overview

Software development projects using the object-oriented approach involve breaking the problem down into multiple classes that can be tied together into a single solution. In this project, you are given the task of creating a program to manage contacts. Specifically, you are asked to identify and implement at least two classes that would work together to make the Contacts application.

Learning Objectives

The focus of this assignment is on the following learning objectives:

  • Be able to identify the contents of class declaration header and class definition files and to segregate class functionality based on class description
  • Be able to write object creation and initialization code in the form of constructors
  • Be able to implement an encapsulated approach while dealing with data members for the classes involved through accessors and mutators (getters and setters)
  • Be able to make the program code spread across multiple files work together for the solution to the computing problem
  • Be able to design and implement classes that are appropriate for a particular application.

Problem Description

In this project, you are asked to create a program to maintain contacts. We would like to store name, email, and phone number in a Contact. The maximum number of contacts that your program can store should be passed as a parameter to the appropriate class. See below.

The following are the operations that your program should provide to its user.

1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts

Example Run

Here is an example run of the program.

---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
0. Exit
$ Enter choice: 1
$ Enter name: Jane
$ Enter email: jane@company.com
$ Enter phone #: 1234567890
---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
0. Exit
$ Enter choice: 1
$ Enter name: Tom
$ Enter email: tom@company.com
$ Enter phone #: 9876543210
---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
0. Exit
$ Enter choice: 3
$ We currently have the following names:
[1. Jane, 2. Tom]
$ Which contact do you want to edit? 1
$ What do you want to edit?
[1. Name, 2. email, 3. phone #]
$ Enter choice: 1
$ Enter new name: Maria
Contact edited successfully
---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
0. Exit
$ Enter choice: 5
[Maria, jane@company.com, 1234567890]
[Tom, tom@company.com, 9876543210]
---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
0. Exit
$ Enter choice: 4
$ Enter name to search for? Maria
[Maria, jane@company.com, 1234567890]
---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
0. Exit
$ Enter choice: 2
$ We currently have the following names:
[1. Maria, 2. Tom]
$ Which contact do you want to remove? 2
Contact removed successfully!
---Main menu---
1. Add a new contact
2. Remove a contact
3. Edit a contact
4. Search for a contact
5. Display all contacts
1. Exit
$ Enter choice: 0
$

Implementation Notes

For this project, you are required to create a Contact class to model a single Contact, ContactManager class to store up to a maximum number of contacts. The maximum number of contacts can be passed as a parameter to the constructor of the ContactManager class.

To allow ContactManager class to store up to a given number of Contacts, you are required to use an array of contacts (with the given size) as a private member of ContactManager. The array needs be dynamically allocated. Also, you may want to use a member variable that indicates how many valid contacts the ContactManager currently have. This variable can be initialized with zero and incremented every time a new contact is added. Similarly, the variable is decremented every time a contact is removed.

If a contact is removed from the middle of the array, you can shift the array elements to the left by one position to maintain contagious positioning of valid contacts.

Development Diary

For this project, you must complete the following tasks in the order that they are described:

  • Write down the list of all classes that you need to implement. For each class, list the associated member variables and the set of member functions.
  • Create a plan to implement your solution to the problem with a timeline. Each step in your plan refers to an increment of the program that you will be creating. It is recommended to complete the implementation of a single logical action per step.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.