Question: Record.h #include using namespace std; class Record { private: int recordNumber; string firstName; string lastName; int age; int telephoneNumber; public: Record(); Record(int, string, string, int,

Record.h

#include using namespace std;

class Record {

private:

int recordNumber; string firstName; string lastName; int age; int telephoneNumber;

public:

Record();

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

//this are the functions

int getRecordNumber(); string getFirstName(); string getLastName(); int getAge(); int getTelephone();

void setRecordNumber(int); void setFirstName(string); void setLastName(string); void setAge(int); void setTelephone(int); void print();

};

Record.cpp

#include #include #include"Record.h"

using namespace std;

Record::Record() { recordNumber = 0; firstName = ""; lastName = ""; age = 0; telephoneNumber = 0; }

Record::Record(int rNum, string firstn, string lastn, int ag, int tNumber) { recordNumber = rNum; firstName = firstn; lastName = lastn; age = ag; telephoneNumber = tNumber; }

//this are the funtions

int Record::getRecordNumber() { return recordNumber; } string Record::getFirstName() { return firstName; } string Record::getLastName() { return lastName; } int Record::getAge() { return age; } int Record::getTelephone() { return telephoneNumber; }

void Record::setRecordNumber(int rNum) { recordNumber = rNum; }

void Record::setFirstName(string firstn) { firstName = firstn; } void Record::setLastName(string lastn) { lastName = lastn; }

void Record::setAge(int ag) { age = ag; } void Record::setTelephone(int tNumber) { telephoneNumber = tNumber; }

void Record::print() //output { cout <

int main() { //this is the array

Record rec[10]; int op, n = 0, age, telephoneNumber; string firstName, lastName;

while (1) {

cout << "1. Input information in the records." << endl; cout << "2. Show all records." << endl; cout << "3. Exit Address Book" << endl; cout << "Please choose your option: "; cin >> op;

switch (op) { case 1: // Requested user information

cout << "Please input your first name: "; cin >> firstName; cout << "Please input your last name: "; cin >> lastName; cout << "Please input your age: "; cin >> age; cout << "Please provide your telephone number: "; cin >> telephoneNumber;

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

break;

case 2: //Show all records

cout << "RecordNumber FirstName LastName Age TelephoneNumber" << endl; cout << "----------------------------------------------------" << endl; for (int i = 0; i < n; i++) { rec[i].print(); }

break;

case 3: //End of the program

cout << "Close Address Book." << endl; return 0; } cout << endl; } }

Modify the program to use the Array Class instead of a basic array.

Make another new program by modifying the address book program above to use the Vector Class instead of a basic array.

Implement exception catching in appropriate areas that may cause errors.

Implement exception catching in at least one area of the program for each of the Array class and Vector class in the programs created.

The code for two finished independent programs (Array and Vector).

Need to separate the implementation of the classes from the header files; and have a .cpp file and a .h file for each class created.

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!