Kat H.

asked • 08/08/21

C++. Collection App with Dynamic Memory

Intro

In this program, you will add another class for managing the array of items. We will be changing any static C string type to a dynamic C string type. Try to keep it reasonable simple but still meet the requirements listed below. And do a makefile and a git repo for this project.


Requirements

Please see the general requirements for further requirements needed. Below is not all the requirements needed in your code.


Tasks

Your program have as a minimum the following tasks.

a. Allow the user to add as many entries as they want to the collection.

b. Allow the user to print out the entire collection.

c. Allow the user to delete an entry from the collection.

d. Allow the user to read in items from a file.

e. Allow the user to write out items to a file.


Code Requirements

The program also needs to have the following in your code and directory:

  1. There should be TWO classes in your code. Once class, which will be a data class, will be for an item in the list. Make sure you have dynamic C strings. The other class, called a collection class, is for holding the array of items plus a count of items. The array and count should be the only two member variables in your collection class.
  2. The code for each class should be in two separate files: a .h header file and a .cpp implementation file. This is beside the main.cpp file so, in all, you need to turn in at least FIVE code files.
  3. Member variables must be declared in the private section of the class. Member function can be declared public if they need to be accessed outside of the class; otherwise they should be private too.
  4. The data class (the item class) should have the following:

a. Getters and setters for all member variables.

b. Default constructor

c. Copy constructor

d. Operator Overloading of the assignment operator (=)

e. Destructor


Step 5. The collection class must have at least a default constructor to initialize the count variable to zero. Other special functions are optional. If you are using any dynamic variables, you need to have a destructor to delete the memory.


Step 6. There should be a makefile in your directory. It will be used to compile the code.

Step 7. There should also be a git repo in your directory. To make sure all code is committed.

1 Expert Answer

By:

Patrick B. answered • 08/10/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.