Purchase Solution

C++ program for RegistrationOffice and Person Class.

Not what you're looking for?

Ask Custom Question

In class, we have been discussing creating objects using the new operator and releasing the memory using the delete operator. Two other similar operators are new[] and delete[]. These operators work the same as the new and delete but with arrays, these are called dynamic arrays:

int size = 5;

// Dynamic arrays don't have to be initialized with constants.

int* ints = new int[size];

// We can rezie the array dynamically.

ints = new int[size];

// Use delete[] to release memory.

delete[] ints;

Create a class Person having the following:

· First name, last name, and middle name with their respective get and set functions. The get functions shall be declared constants.

· A default constructor.

· Overload the operators == and !=. The equality operator shall evaluate to true when the social security numbers are equal. The not equals operator shall evaluate to true when the social security numbers are not equal.

Then use your class Person to create a class RegistrationOffice. This class shall have the following:

· A dynamic array of Person objects. Initially the array will have size 10.

· A function register(Person&). This function will add the specified person to the array. Make sure to check the size of the array and resize it if the array is out of space.

· A function remove(int). This function will search the array for the person having the specified social security and remove it from the array. Make sure to shift the needed elements of the array.

· A function find(int). This function will search the array and return the person having the specified social security.

· A function display(void). This function will display to the screen all the people registered.

· Overload the operator << taking a Person object as parameter. This operator will perform the same logic as register.

· Overload the operator [ ] taking an int as parameter. This operator will perform the same logic as find.

In your driver class, make sure to test all the functions created in both classes.

Purchase this Solution

Solution Summary

The solution contains the C++ program with a very beautifully written code. The code is completely commented and properly indented so that the reader can grasp the code very easily. Grab the solution from the library and enjoy.

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Basic Networking Questions

This quiz consists of some basic networking questions.