Question: In C + + , Create a container class people that holds an array of 2 0 person objects. Write a program that uses the

In C++, Create a container class people that holds an array of 20 person objects. Write a program that uses the container class people to store the contents of an input. This class should use dynamic memory allocation and clean up memory when it is destroyed. Test your program with the code and data files below.
You may not change the Main.cpp file.
The people class should have the following data element:
Map - a pointer to an array of person objects.
Len - the number of objects in use.
The people class should have the following functions:
Null constructor - create storage for array using new.
Destructor - delete array storage using [] delete.
Insert - add a person to the array, in ascending order.
Display - put the entire array to an output stream, and show the number of person items, and the average age.
Find - given an id, locate a matching person in the list. Return true if found, false if not.
Remove - given an id, remove a matching person from the list.
You will need to update your person class to add the following:
ID - a private data element
== compare the person to an integer, using the id data.
When inserting an item to the array, dont just append it to the end, and then sort the list. This works, but is very inefficient. Instead, determine where the item should go, and shift the rest of the array to make room.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!