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.
The focus of this assignment is on the following learning objectives:
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
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
$
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.
For this project, you must complete the following tasks in the order that they are described: