How do I create a new program in C++ by modifying the address book program you created in the previous module? Modify the program to use the Array Class instead of a basic array. Create another new program by modifying the address book program created in the previous module to use the Vector Class instead of a basic array. Implement exception-catching in appropriate areas that may cause errors. You should implement exception catching in at least one area of the program for each of the Array class and Vector class programs you create. You will need to submit the code for two finished independent programs (Array and Vector). Make sure to separate the implementation of your classes from the header files.

Current code:
/***** Record.h *****/

#ifndef RECORD_H

#define RECORD_H

#include

using namespace std;

//Record class

class Record

{

private:

//private data member

int recordNumber;

string firstName;

string lastName;

int age;

int telephone;

public:

//default constructor

Record();

//parameterized constructor

Record(int, string, string, int, int);

//getter functions

int getRecordNumber();

string getFirstName();

string getLastName();

int getAge();

int getTelephone();

//setter functions

void setRecordNumber(int);

void setFirstName(string);

void setLastName(string);

void setAge(int);

void setTelephone(int);

void print();

};

#endif // RECORD_H


/***** Record.cpp *****/

#include

#include

#include"Record.h"

using namespace std;

//default constructor

Record::Record()

{

recordNumber = 0;

firstName = "";

lastName = "";

age = 0;

telephone = 0;

}

//parameterized constructor

Record::Record(int rno, string fn, string ln, int ag, int tno)

{

recordNumber = rno;

firstName = fn;

lastName = ln;

age = ag;

telephone = tno;

}

//getter functions

int Record::getRecordNumber() //returns the recordNumber

{

return recordNumber;

}

string Record::getFirstName() //returns the firstname

{

return firstName;

}

string Record::getLastName() //returns the lastname

{

return lastName;

}

int Record::getAge() //returns the age

{

return age;

}

int Record::getTelephone() //returns the telephone

{

return telephone;

}

//setter functions

void Record::setRecordNumber(int rno) //set the recordNumber

{

recordNumber = rno;

}

void Record::setFirstName(string fn) //set the firstname

{

firstName = fn;

}

void Record::setLastName(string ln) //set the lastname

{

lastName = ln;

}

void Record::setAge(int ag) //set the age

{

age = ag;

}

void Record::setTelephone(int tno) // //set the telephone

{

telephone = tno;

}

void Record::print() //print a record

{

cout<

#include"Record.h"

using namespace std;

//main function

int main()

{

//array of Record

Record rec[10];

int op, n=0, age, telephone;

string firstName, lastName;

while(1)

{

// prints the menu

cout << "1. Input information into an record." << endl;

cout << "2. Display all information in all records." << endl;

cout << "3. Exit the program" << endl;

cout << "Enter option: ";

cin >> op;

switch(op)

{

case 1: //Input information into an record

cout<<"Enter first name: ";

cin >> firstName;

cout<<"Enter last name: ";

cin >> lastName;

cout<<"Enter age: ";

cin >> age;

cout<<"Enter telephone number: ";

cin >> telephone;

rec[n] = Record(n+1, firstName, lastName, age, telephone);

n++;

break;

case 2: //Display all information in all records

cout<<"Record Number FirstName LastName Age Telephone-Number"<
cout<<"-----------------------------------------------------"<
for(int i=0; i
{

rec[i].print();

}

break;

case 3: //Exit the program

cout<< "Exit the program." << endl;

return 0;

}

cout<
}

}