The purpose of this lab is to give you a deeper understanding of memory management by forcing you to utilize the standard C++ heap structure as much as possible.
Build a normalized student record system. Create a class to represent student data. You will also create classes to handle other specific types of data including dates and addresses. Your system will include all the necessary header files, cpp files, Makefile, and a main program to incorporate the larger system.
Imagine a university wants to keep track of the following data about each student:
First name
Last name
address line 1
address line 2
city
state
zip code
date of birth month
date of birth day
date of birth year
anticipated completion month
anticipated completion day
anticipated completion year
gpa
credit hours completed
It is obvious that we will need a student class to contain all this data. However, the principles of data design indicate that the address should be its own class, as should the date. Your program should then have at least three classes: address, date, and student. Student will have two instances of date and one of address among its data members.
Build all the classes you will need for this project. Each class should have a separate header file. This file contains only the class definition. Ensure your headers use the #ifndef structure described in lecture, and include whatever other headers they need.
Build a cpp file for each class which contains the code implementation of the class. This code file will include the class header file and any other headers and libraries needed.
Build a main program that imports all the needed classes and tests them. You'll then modify this program.
Create a makefile to control the compilation process. The instructor will test the program by running the make utility, so be sure your makefile works. If you use a visual editor like code::blocks, you'll still need to create and test a makefile for your project. Note IDE's have tools to build make files automatically, but they are often terrible. Make your own. It's must include to include clean and run builds in your makefile along with a command to run Valgrind. Look at Andy's example for guidance on how to create it, but the command should be called valgrind.
Use git to manage your versions. There is no way you can prove you used git, but learn how to use it now. It's ideal for a larger project like this with multiple files.
All instances of your classes should be stored separately on the heap. That is to say, all should make use of the 'new' keyword. Your program will be tested using the Valgrind tool to ensure you have responsibly deallocated memory when your are done with it.
When the classes are done, create a main program which does the following:
Here is the format you may use for a line of student data in your text file:
Surname, GivenName, StreetAddress, Address2, City, State, ZipCode, Birthday, Graduation, GPA, Credit Hours Complete< end of line>
Note that the text file provided by your recitation leader might be slightly different. Use the data you're given.
Here is an example of what it may look like:
Fry, Lock, 123 Hillside Drive, ,North Brunswick, NJ, 57237, 08/22/1970, 05/15/2012, 4.00, 90