SlideShare a Scribd company logo
1 of 8
Download to read offline
So here is the code from the previous assignment that we need to extend just follow the
instructions above.
main.cpp
#include
#include "Contact.h"
int main()
{
// create Contact object using parameterized constructor
Contact c1("Barbara", "Liskov", "Huberman", "404 Ridgeway Dr", "NC", "27403", "336-274-
3344");
// show contact details
c1.showContact();
cout << endl;
// create Contact object using default constructor
Contact c2;
// test the overloaded input and output operators
cin >> c2;
cout << endl;
cout << c2;
return 0;
}
Address.h
#ifndef ADDRESS_H
#define ADDRESS_H
#include
using namespace std;
// create a class named Address
class Address
{
private:
// private instance variables
string streetAddress, state, zip;
public:
// default constructor
Address()
{
// initialize instance variables with empty strings
streetAddress = "";
state = "";
zip = "";
}
// parameterized constructor
Address(string streetAddress, string state, string zip)
{
// initialize instance variables to given parameters
this->streetAddress = streetAddress;
this->state = state;
this->zip = zip;
}
// copy constructor
Address(const Address &a)
{
streetAddress = a.streetAddress;
state = a.state;
zip = a.zip;
}
// setters for all instance variables
void setStreetAddress(string streetAddress) { this->streetAddress = streetAddress; }
void setState(string state) { this->state = state; }
void setZip(string zip) { this->zip = zip; }
// getters for all instance variables
string getStreetAddress() { return streetAddress; }
string getState() { return state; }
string getZip() { return zip; }
// method to display the address
void showAddress()
{
cout << streetAddress << "n"
<< state << " " << zip << endl;
}
// declare the overloaded input and output operators
friend ostream &operator<<(ostream &out, const Address &a);
friend istream &operator>>(istream &in, Address &a);
};
// define the overloaded output operator
ostream &operator<<(ostream &out, const Address &a)
{
out << a.streetAddress << "n"
<< a.state << " " << a.zip << endl;
return out;
}
// define the overloaded input operator
istream &operator>>(istream &in, Address &a)
{
cout << "Enter street address: ";
getline(in, a.streetAddress);
cout << "Enter state: ";
getline(in, a.state);
cout << "Enter zip: ";
getline(in, a.zip);
return in;
}
#endif
Contact.h
#ifndef CONTACT_H
#define CONTACT_H
#include
#include "Name.h"
#include "Address.h"
using namespace std;
// create a class named Contact
class Contact
{
private:
// private instance variables
Name name;
Address address;
string phone;
public:
// default constructor
Contact()
{
// initialize phone with empty string
phone = "";
}
// parameterized constructor
Contact(string first_name, string last_name, string middle_name, string streetAddress, string
state, string zip, string phone)
{
// initialize name and address to given strings
setName(first_name, last_name, middle_name);
setAddress(streetAddress, state, zip);
// initialize phone to the given parameter
this->phone = phone;
}
// copy constructor
Contact(const Contact &c)
{
name = c.name;
address = c.address;
phone = c.phone;
}
// setters for all instance variables
void setName(string first_name, string last_name, string middle_name)
{
this->name.setFirst_Name(first_name);
this->name.setLast_Name(last_name);
this->name.setMiddle_Name(middle_name);
}
void setAddress(string streetAddress, string state, string zip)
{
this->address.setStreetAddress(streetAddress);
this->address.setState(state);
this->address.setZip(zip);
}
void setPhone(string phone) { this->phone = phone; }
// getters for all instance variables
string getName()
{
return name.getFirst_Name() + " " + name.getMiddle_Name() + " " + name.getMiddle_Name();
}
string getAddress()
{
return address.getStreetAddress() + ", " + address.getState() + " - " + address.getZip();
}
string getPhone() { return phone; }
// method to display the contact details
void showContact()
{
name.showName();
address.showAddress();
cout << phone << endl;
}
// declare the overloaded input and output operators
friend ostream &operator<<(ostream &out, const Contact &c);
friend istream &operator>>(istream &in, Contact &c);
};
// define the overloaded output operator
ostream &operator<<(ostream &out, const Contact &c)
{
out << c.name;
out << c.address;
out << c.phone << endl;
return out;
}
// define the overloaded input operator
istream &operator>>(istream &in, Contact &c)
{
in >> c.name;
in >> c.address;
cout << "Enter phone number: ";
getline(in, c.phone);
return in;
}
#endif
Name.h
#ifndef NAME_H
#define NAME_H
#include
using namespace std;
// create a class named Name
class Name
{
private:
// private instance variables
string first_name, last_name, middle_name;
public:
// default constructor
Name()
{
// initialize instance variables with empty strings
first_name = "";
last_name = "";
middle_name = "";
}
// parameterized constructor
Name(string first_name, string last_name, string middle_name)
{
// initialize instance variables to given parameters
this->first_name = first_name;
this->last_name = last_name;
this->middle_name = middle_name;
}
// copy constructor
Name(const Name &n)
{
first_name = n.first_name;
last_name = n.last_name;
middle_name = n.middle_name;
}
// setters for all instance variables
void setFirst_Name(string first_name) { this->first_name = first_name; }
void setLast_Name(string last_name) { this->last_name = last_name; }
void setMiddle_Name(string middle_name) { this->middle_name = middle_name; }
// getters for all instance variables
string getFirst_Name() { return first_name; }
string getLast_Name() { return last_name; }
string getMiddle_Name() { return middle_name; }
// method to display the name
void showName()
{
cout << last_name << ", " << first_name << " " << middle_name[0] << "." << endl;
}
// declare the overloaded input and output operators
friend ostream &operator<<(ostream &out, const Name &n);
friend istream &operator>>(istream &in, Name &n);
};
// define the overloaded output operator
ostream &operator<<(ostream &out, const Name &n)
{
out << n.last_name << ", " << n.first_name << " " << n.middle_name[0] << "." << endl;
return out;
}
// define the overloaded input operator
istream &operator>>(istream &in, Name &n)
{
cout << "Enter first name: ";
getline(in, n.first_name);
cout << "Enter last name: ";
getline(in, n.last_name);
cout << "Enter middle name: ";
getline(in, n.middle_name);
return in;
}
#endif The purpose of this assignment is to assess your ability to do the following: - Implement
a class with static data. - Implement classes utilizing aggregating relationships. - Utilize
aggregate objects in a software solution. - Utilize file input/output in a C++ program. For this
assignment, you will extend the Contact Management System 1 by creating a ContactManager
class to manage a collection of Contact objects. Before starting your assignment, ensure that your
Name, Address, and Contact class are error free. Step 1: Add a public static integer variable
called total Ct to the Contact class. Add a private integer instance variable called identifier and a
private member function, setIdentifier (), to the Contact class as shown below. Initialize totalct in
your .cpp file and implement setIdentifier() as shown here:
Declare a ContactManager class according to the given UML design. Implement the functions
according to the following specification: - The constructor needs an empty body. The job of the
constructor is to initialize the instance variables in the class. The instance variable here is a
vector that is initialized by the vector class constructor. There are no additional steps needed in
the ContactManager constructor. - getContact () takes an integer id and searches contacts to find
a Contact with a matching identifier. The matching Contact is returned. If no matching Contact is
found, return a default Contact object. - getContacts () takes a string l_name and searches the
contacts to find all Contact objects with a matching last name. The function returns a vector of
all matching Contact objects. - addContact() prompts the user for a new contact data, creates a
Contact object, and adds the contact to contacts. - showContact() displays the contacts in a
formatted output. - saveContacts() writes all of the contact data to the output source out. -
loadContacts() loads raw contact data from the input source in, assigns each Contact object an
identifier, and adds each Contact to contacts.

More Related Content

Similar to So here is the code from the previous assignment that we need to ext.pdf

Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloadingankush_kumar
 
in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfstopgolook
 
Help with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdfHelp with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdfezzi97
 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdfadityastores21
 
FUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptxFUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptxDeepasCSE
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdffortmdu
 
OverviewWe will be adding some validation to our Contact classes t.pdf
OverviewWe will be adding some validation to our Contact classes t.pdfOverviewWe will be adding some validation to our Contact classes t.pdf
OverviewWe will be adding some validation to our Contact classes t.pdffathimaoptical
 
#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdfannucommunication1
 
could you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdfcould you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdfferoz544
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfnaslin841216
 
chapter-7 slide.pptx
chapter-7 slide.pptxchapter-7 slide.pptx
chapter-7 slide.pptxcricketreview
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operatorSAFFI Ud Din Ahmad
 
write the To Dos to get the exact outputNOte A valid Fraction .pdf
write the To Dos to get the exact outputNOte A valid Fraction .pdfwrite the To Dos to get the exact outputNOte A valid Fraction .pdf
write the To Dos to get the exact outputNOte A valid Fraction .pdfjyothimuppasani1
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxShashiShash2
 
#include iostream #include fstream #include cstdlib #.pdf
 #include iostream #include fstream #include cstdlib #.pdf #include iostream #include fstream #include cstdlib #.pdf
#include iostream #include fstream #include cstdlib #.pdfannesmkt
 
OOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxOOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxSirRafiLectures
 
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfHey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfrishabjain5053
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptishan743441
 

Similar to So here is the code from the previous assignment that we need to ext.pdf (20)

Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
 
in c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdfin c languageTo determine the maximum string length, we need to .pdf
in c languageTo determine the maximum string length, we need to .pdf
 
Help with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdfHelp with the following code1. Rewrite to be contained in a vecto.pdf
Help with the following code1. Rewrite to be contained in a vecto.pdf
 
maincpp Build and procees a sorted linked list of Patie.pdf
maincpp   Build and procees a sorted linked list of Patie.pdfmaincpp   Build and procees a sorted linked list of Patie.pdf
maincpp Build and procees a sorted linked list of Patie.pdf
 
FUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptxFUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptx
 
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdfAssignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
Assignment isPage 349-350 #4 and #5 Use the Linked List lab.pdf
 
OverviewWe will be adding some validation to our Contact classes t.pdf
OverviewWe will be adding some validation to our Contact classes t.pdfOverviewWe will be adding some validation to our Contact classes t.pdf
OverviewWe will be adding some validation to our Contact classes t.pdf
 
#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf
 
could you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdfcould you implement this function please, im having issues with it..pdf
could you implement this function please, im having issues with it..pdf
 
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdfinclude ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdf
 
chapter-7 slide.pptx
chapter-7 slide.pptxchapter-7 slide.pptx
chapter-7 slide.pptx
 
18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator18 dec pointers and scope resolution operator
18 dec pointers and scope resolution operator
 
write the To Dos to get the exact outputNOte A valid Fraction .pdf
write the To Dos to get the exact outputNOte A valid Fraction .pdfwrite the To Dos to get the exact outputNOte A valid Fraction .pdf
write the To Dos to get the exact outputNOte A valid Fraction .pdf
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
 
#include iostream #include fstream #include cstdlib #.pdf
 #include iostream #include fstream #include cstdlib #.pdf #include iostream #include fstream #include cstdlib #.pdf
#include iostream #include fstream #include cstdlib #.pdf
 
OOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxOOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptx
 
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdfHey, I need some help coding this C++ assignment.ObjectivesThis.pdf
Hey, I need some help coding this C++ assignment.ObjectivesThis.pdf
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.ppt
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 

More from leolight2

Si el gobierno se hubiera apoderado de los activos de Global Trading.pdf
Si el gobierno se hubiera apoderado de los activos de Global Trading.pdfSi el gobierno se hubiera apoderado de los activos de Global Trading.pdf
Si el gobierno se hubiera apoderado de los activos de Global Trading.pdfleolight2
 
Si bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdf
Si bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdfSi bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdf
Si bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdfleolight2
 
SHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdf
SHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdfSHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdf
SHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdfleolight2
 
Si bien la mayor�a de los visitantes de Washington, DC, visitan los .pdf
Si bien la mayor�a de los visitantes de Washington, DC, visitan los .pdfSi bien la mayor�a de los visitantes de Washington, DC, visitan los .pdf
Si bien la mayor�a de los visitantes de Washington, DC, visitan los .pdfleolight2
 
Si bien es importante que los vendedores internacionales aprecien .pdf
Si bien es importante que los vendedores internacionales aprecien .pdfSi bien es importante que los vendedores internacionales aprecien .pdf
Si bien es importante que los vendedores internacionales aprecien .pdfleolight2
 
Show the Relational Algebra formula for each. This one may be a phot.pdf
Show the Relational Algebra formula for each. This one may be a phot.pdfShow the Relational Algebra formula for each. This one may be a phot.pdf
Show the Relational Algebra formula for each. This one may be a phot.pdfleolight2
 
should be at least two paragraphs long, or more, depending upon the .pdf
should be at least two paragraphs long, or more, depending upon the .pdfshould be at least two paragraphs long, or more, depending upon the .pdf
should be at least two paragraphs long, or more, depending upon the .pdfleolight2
 
Should Governments Report Like BusinessesHistorically, states a.pdf
Should Governments Report Like BusinessesHistorically, states a.pdfShould Governments Report Like BusinessesHistorically, states a.pdf
Should Governments Report Like BusinessesHistorically, states a.pdfleolight2
 
Seventy-three percent of adults in a certain country believe that li.pdf
Seventy-three percent of adults in a certain country believe that li.pdfSeventy-three percent of adults in a certain country believe that li.pdf
Seventy-three percent of adults in a certain country believe that li.pdfleolight2
 
Sheffield Corporation, a private corporation, was organized on Febru.pdf
Sheffield Corporation, a private corporation, was organized on Febru.pdfSheffield Corporation, a private corporation, was organized on Febru.pdf
Sheffield Corporation, a private corporation, was organized on Febru.pdfleolight2
 
SHOW ANSWER ON GRAPH Many demographers predict that the United State.pdf
SHOW ANSWER ON GRAPH Many demographers predict that the United State.pdfSHOW ANSWER ON GRAPH Many demographers predict that the United State.pdf
SHOW ANSWER ON GRAPH Many demographers predict that the United State.pdfleolight2
 
Ser capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdf
Ser capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdfSer capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdf
Ser capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdfleolight2
 
Solve all of them If the marginal propensity to save is 0.25 , then.pdf
Solve all of them  If the marginal propensity to save is 0.25 , then.pdfSolve all of them  If the marginal propensity to save is 0.25 , then.pdf
Solve all of them If the marginal propensity to save is 0.25 , then.pdfleolight2
 
Solution Register a service endpoint in the Dataverse instance that.pdf
Solution Register a service endpoint in the Dataverse instance that.pdfSolution Register a service endpoint in the Dataverse instance that.pdf
Solution Register a service endpoint in the Dataverse instance that.pdfleolight2
 
Solutions for The Toliza Museum of Art, did not cover all the answer.pdf
Solutions for The Toliza Museum of Art, did not cover all the answer.pdfSolutions for The Toliza Museum of Art, did not cover all the answer.pdf
Solutions for The Toliza Museum of Art, did not cover all the answer.pdfleolight2
 
Soles es una empresa de calzado que ha abierto recientemente su tien.pdf
Soles es una empresa de calzado que ha abierto recientemente su tien.pdfSoles es una empresa de calzado que ha abierto recientemente su tien.pdf
Soles es una empresa de calzado que ha abierto recientemente su tien.pdfleolight2
 
So I have 3 enums named land_type, entity, tile as shown enum lan.pdf
So I have 3 enums named land_type, entity, tile as shown enum lan.pdfSo I have 3 enums named land_type, entity, tile as shown enum lan.pdf
So I have 3 enums named land_type, entity, tile as shown enum lan.pdfleolight2
 
So for C-ferns the CP is the commonwild type (green) and the cp is .pdf
So for C-ferns the CP is the commonwild type (green) and the cp is .pdfSo for C-ferns the CP is the commonwild type (green) and the cp is .pdf
So for C-ferns the CP is the commonwild type (green) and the cp is .pdfleolight2
 
So I need to create a compound word game, and I dont quite understa.pdf
So I need to create a compound word game, and I dont quite understa.pdfSo I need to create a compound word game, and I dont quite understa.pdf
So I need to create a compound word game, and I dont quite understa.pdfleolight2
 
SLL Corporation�s balance sheet is shown below. The current rate on .pdf
SLL Corporation�s balance sheet is shown below. The current rate on .pdfSLL Corporation�s balance sheet is shown below. The current rate on .pdf
SLL Corporation�s balance sheet is shown below. The current rate on .pdfleolight2
 

More from leolight2 (20)

Si el gobierno se hubiera apoderado de los activos de Global Trading.pdf
Si el gobierno se hubiera apoderado de los activos de Global Trading.pdfSi el gobierno se hubiera apoderado de los activos de Global Trading.pdf
Si el gobierno se hubiera apoderado de los activos de Global Trading.pdf
 
Si bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdf
Si bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdfSi bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdf
Si bien puede diferir en otros pa�ses, en los Estados Unidos la dist.pdf
 
SHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdf
SHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdfSHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdf
SHOW STEPS IN EXCEL PLEASE.Data DayDateWeekdayDaily Deman.pdf
 
Si bien la mayor�a de los visitantes de Washington, DC, visitan los .pdf
Si bien la mayor�a de los visitantes de Washington, DC, visitan los .pdfSi bien la mayor�a de los visitantes de Washington, DC, visitan los .pdf
Si bien la mayor�a de los visitantes de Washington, DC, visitan los .pdf
 
Si bien es importante que los vendedores internacionales aprecien .pdf
Si bien es importante que los vendedores internacionales aprecien .pdfSi bien es importante que los vendedores internacionales aprecien .pdf
Si bien es importante que los vendedores internacionales aprecien .pdf
 
Show the Relational Algebra formula for each. This one may be a phot.pdf
Show the Relational Algebra formula for each. This one may be a phot.pdfShow the Relational Algebra formula for each. This one may be a phot.pdf
Show the Relational Algebra formula for each. This one may be a phot.pdf
 
should be at least two paragraphs long, or more, depending upon the .pdf
should be at least two paragraphs long, or more, depending upon the .pdfshould be at least two paragraphs long, or more, depending upon the .pdf
should be at least two paragraphs long, or more, depending upon the .pdf
 
Should Governments Report Like BusinessesHistorically, states a.pdf
Should Governments Report Like BusinessesHistorically, states a.pdfShould Governments Report Like BusinessesHistorically, states a.pdf
Should Governments Report Like BusinessesHistorically, states a.pdf
 
Seventy-three percent of adults in a certain country believe that li.pdf
Seventy-three percent of adults in a certain country believe that li.pdfSeventy-three percent of adults in a certain country believe that li.pdf
Seventy-three percent of adults in a certain country believe that li.pdf
 
Sheffield Corporation, a private corporation, was organized on Febru.pdf
Sheffield Corporation, a private corporation, was organized on Febru.pdfSheffield Corporation, a private corporation, was organized on Febru.pdf
Sheffield Corporation, a private corporation, was organized on Febru.pdf
 
SHOW ANSWER ON GRAPH Many demographers predict that the United State.pdf
SHOW ANSWER ON GRAPH Many demographers predict that the United State.pdfSHOW ANSWER ON GRAPH Many demographers predict that the United State.pdf
SHOW ANSWER ON GRAPH Many demographers predict that the United State.pdf
 
Ser capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdf
Ser capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdfSer capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdf
Ser capaz de amplificar fragmentos de ADN espec�ficos es fundamental.pdf
 
Solve all of them If the marginal propensity to save is 0.25 , then.pdf
Solve all of them  If the marginal propensity to save is 0.25 , then.pdfSolve all of them  If the marginal propensity to save is 0.25 , then.pdf
Solve all of them If the marginal propensity to save is 0.25 , then.pdf
 
Solution Register a service endpoint in the Dataverse instance that.pdf
Solution Register a service endpoint in the Dataverse instance that.pdfSolution Register a service endpoint in the Dataverse instance that.pdf
Solution Register a service endpoint in the Dataverse instance that.pdf
 
Solutions for The Toliza Museum of Art, did not cover all the answer.pdf
Solutions for The Toliza Museum of Art, did not cover all the answer.pdfSolutions for The Toliza Museum of Art, did not cover all the answer.pdf
Solutions for The Toliza Museum of Art, did not cover all the answer.pdf
 
Soles es una empresa de calzado que ha abierto recientemente su tien.pdf
Soles es una empresa de calzado que ha abierto recientemente su tien.pdfSoles es una empresa de calzado que ha abierto recientemente su tien.pdf
Soles es una empresa de calzado que ha abierto recientemente su tien.pdf
 
So I have 3 enums named land_type, entity, tile as shown enum lan.pdf
So I have 3 enums named land_type, entity, tile as shown enum lan.pdfSo I have 3 enums named land_type, entity, tile as shown enum lan.pdf
So I have 3 enums named land_type, entity, tile as shown enum lan.pdf
 
So for C-ferns the CP is the commonwild type (green) and the cp is .pdf
So for C-ferns the CP is the commonwild type (green) and the cp is .pdfSo for C-ferns the CP is the commonwild type (green) and the cp is .pdf
So for C-ferns the CP is the commonwild type (green) and the cp is .pdf
 
So I need to create a compound word game, and I dont quite understa.pdf
So I need to create a compound word game, and I dont quite understa.pdfSo I need to create a compound word game, and I dont quite understa.pdf
So I need to create a compound word game, and I dont quite understa.pdf
 
SLL Corporation�s balance sheet is shown below. The current rate on .pdf
SLL Corporation�s balance sheet is shown below. The current rate on .pdfSLL Corporation�s balance sheet is shown below. The current rate on .pdf
SLL Corporation�s balance sheet is shown below. The current rate on .pdf
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfUmakantAnnand
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docxPoojaSen20
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Concept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.CompdfConcept of Vouching. B.Com(Hons) /B.Compdf
Concept of Vouching. B.Com(Hons) /B.Compdf
 
MENTAL STATUS EXAMINATION format.docx
MENTAL     STATUS EXAMINATION format.docxMENTAL     STATUS EXAMINATION format.docx
MENTAL STATUS EXAMINATION format.docx
 

So here is the code from the previous assignment that we need to ext.pdf

  • 1. So here is the code from the previous assignment that we need to extend just follow the instructions above. main.cpp #include #include "Contact.h" int main() { // create Contact object using parameterized constructor Contact c1("Barbara", "Liskov", "Huberman", "404 Ridgeway Dr", "NC", "27403", "336-274- 3344"); // show contact details c1.showContact(); cout << endl; // create Contact object using default constructor Contact c2; // test the overloaded input and output operators cin >> c2; cout << endl; cout << c2; return 0; } Address.h #ifndef ADDRESS_H #define ADDRESS_H #include using namespace std; // create a class named Address class Address { private: // private instance variables string streetAddress, state, zip;
  • 2. public: // default constructor Address() { // initialize instance variables with empty strings streetAddress = ""; state = ""; zip = ""; } // parameterized constructor Address(string streetAddress, string state, string zip) { // initialize instance variables to given parameters this->streetAddress = streetAddress; this->state = state; this->zip = zip; } // copy constructor Address(const Address &a) { streetAddress = a.streetAddress; state = a.state; zip = a.zip; } // setters for all instance variables void setStreetAddress(string streetAddress) { this->streetAddress = streetAddress; } void setState(string state) { this->state = state; } void setZip(string zip) { this->zip = zip; } // getters for all instance variables string getStreetAddress() { return streetAddress; } string getState() { return state; } string getZip() { return zip; } // method to display the address void showAddress() { cout << streetAddress << "n"
  • 3. << state << " " << zip << endl; } // declare the overloaded input and output operators friend ostream &operator<<(ostream &out, const Address &a); friend istream &operator>>(istream &in, Address &a); }; // define the overloaded output operator ostream &operator<<(ostream &out, const Address &a) { out << a.streetAddress << "n" << a.state << " " << a.zip << endl; return out; } // define the overloaded input operator istream &operator>>(istream &in, Address &a) { cout << "Enter street address: "; getline(in, a.streetAddress); cout << "Enter state: "; getline(in, a.state); cout << "Enter zip: "; getline(in, a.zip); return in; } #endif Contact.h #ifndef CONTACT_H #define CONTACT_H #include #include "Name.h" #include "Address.h" using namespace std; // create a class named Contact class Contact
  • 4. { private: // private instance variables Name name; Address address; string phone; public: // default constructor Contact() { // initialize phone with empty string phone = ""; } // parameterized constructor Contact(string first_name, string last_name, string middle_name, string streetAddress, string state, string zip, string phone) { // initialize name and address to given strings setName(first_name, last_name, middle_name); setAddress(streetAddress, state, zip); // initialize phone to the given parameter this->phone = phone; } // copy constructor Contact(const Contact &c) { name = c.name; address = c.address; phone = c.phone; } // setters for all instance variables void setName(string first_name, string last_name, string middle_name) { this->name.setFirst_Name(first_name); this->name.setLast_Name(last_name); this->name.setMiddle_Name(middle_name);
  • 5. } void setAddress(string streetAddress, string state, string zip) { this->address.setStreetAddress(streetAddress); this->address.setState(state); this->address.setZip(zip); } void setPhone(string phone) { this->phone = phone; } // getters for all instance variables string getName() { return name.getFirst_Name() + " " + name.getMiddle_Name() + " " + name.getMiddle_Name(); } string getAddress() { return address.getStreetAddress() + ", " + address.getState() + " - " + address.getZip(); } string getPhone() { return phone; } // method to display the contact details void showContact() { name.showName(); address.showAddress(); cout << phone << endl; } // declare the overloaded input and output operators friend ostream &operator<<(ostream &out, const Contact &c); friend istream &operator>>(istream &in, Contact &c); }; // define the overloaded output operator ostream &operator<<(ostream &out, const Contact &c) { out << c.name; out << c.address; out << c.phone << endl; return out;
  • 6. } // define the overloaded input operator istream &operator>>(istream &in, Contact &c) { in >> c.name; in >> c.address; cout << "Enter phone number: "; getline(in, c.phone); return in; } #endif Name.h #ifndef NAME_H #define NAME_H #include using namespace std; // create a class named Name class Name { private: // private instance variables string first_name, last_name, middle_name; public: // default constructor Name() { // initialize instance variables with empty strings first_name = ""; last_name = ""; middle_name = ""; } // parameterized constructor Name(string first_name, string last_name, string middle_name) { // initialize instance variables to given parameters
  • 7. this->first_name = first_name; this->last_name = last_name; this->middle_name = middle_name; } // copy constructor Name(const Name &n) { first_name = n.first_name; last_name = n.last_name; middle_name = n.middle_name; } // setters for all instance variables void setFirst_Name(string first_name) { this->first_name = first_name; } void setLast_Name(string last_name) { this->last_name = last_name; } void setMiddle_Name(string middle_name) { this->middle_name = middle_name; } // getters for all instance variables string getFirst_Name() { return first_name; } string getLast_Name() { return last_name; } string getMiddle_Name() { return middle_name; } // method to display the name void showName() { cout << last_name << ", " << first_name << " " << middle_name[0] << "." << endl; } // declare the overloaded input and output operators friend ostream &operator<<(ostream &out, const Name &n); friend istream &operator>>(istream &in, Name &n); }; // define the overloaded output operator ostream &operator<<(ostream &out, const Name &n) { out << n.last_name << ", " << n.first_name << " " << n.middle_name[0] << "." << endl; return out; } // define the overloaded input operator
  • 8. istream &operator>>(istream &in, Name &n) { cout << "Enter first name: "; getline(in, n.first_name); cout << "Enter last name: "; getline(in, n.last_name); cout << "Enter middle name: "; getline(in, n.middle_name); return in; } #endif The purpose of this assignment is to assess your ability to do the following: - Implement a class with static data. - Implement classes utilizing aggregating relationships. - Utilize aggregate objects in a software solution. - Utilize file input/output in a C++ program. For this assignment, you will extend the Contact Management System 1 by creating a ContactManager class to manage a collection of Contact objects. Before starting your assignment, ensure that your Name, Address, and Contact class are error free. Step 1: Add a public static integer variable called total Ct to the Contact class. Add a private integer instance variable called identifier and a private member function, setIdentifier (), to the Contact class as shown below. Initialize totalct in your .cpp file and implement setIdentifier() as shown here: Declare a ContactManager class according to the given UML design. Implement the functions according to the following specification: - The constructor needs an empty body. The job of the constructor is to initialize the instance variables in the class. The instance variable here is a vector that is initialized by the vector class constructor. There are no additional steps needed in the ContactManager constructor. - getContact () takes an integer id and searches contacts to find a Contact with a matching identifier. The matching Contact is returned. If no matching Contact is found, return a default Contact object. - getContacts () takes a string l_name and searches the contacts to find all Contact objects with a matching last name. The function returns a vector of all matching Contact objects. - addContact() prompts the user for a new contact data, creates a Contact object, and adds the contact to contacts. - showContact() displays the contacts in a formatted output. - saveContacts() writes all of the contact data to the output source out. - loadContacts() loads raw contact data from the input source in, assigns each Contact object an identifier, and adds each Contact to contacts.