SlideShare a Scribd company logo
Use the code below from the previous assignment that we need to extend just follow the
instructions above.
***Make sure after you are done to show the output of your results***
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 Use the code below from the previous assignment that we need to exte.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
adityastores21
 
operating system Ubunut,Linux,Mac filename messageService.cpp.pdf
 operating system Ubunut,Linux,Mac filename messageService.cpp.pdf operating system Ubunut,Linux,Mac filename messageService.cpp.pdf
operating system Ubunut,Linux,Mac filename messageService.cpp.pdf
annethafashion
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloadingankush_kumar
 
FUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptxFUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptx
DeepasCSE
 
OOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxOOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptx
SirRafiLectures
 
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
jyothimuppasani1
 
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
 
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
fortmdu
 
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfAssignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
formicreation
 
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
fathimaoptical
 
Frequency .java Word frequency counter package frequ.pdf
Frequency .java  Word frequency counter  package frequ.pdfFrequency .java  Word frequency counter  package frequ.pdf
Frequency .java Word frequency counter package frequ.pdf
arshiartpalace
 
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
rishabjain5053
 
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdfTask #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
info706022
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
ShashiShash2
 
C++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptxC++ FUNCTIONS-1.pptx
C++ FUNCTIONS-1.pptx
Abubakar524802
 
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
feroz544
 
Oops presentation
Oops presentationOops presentation
Oops presentation
sushamaGavarskar1
 
#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
annucommunication1
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.ppt
ishan743441
 
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
ezzi97
 

Similar to Use the code below from the previous assignment that we need to exte.pdf (20)

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
 
operating system Ubunut,Linux,Mac filename messageService.cpp.pdf
 operating system Ubunut,Linux,Mac filename messageService.cpp.pdf operating system Ubunut,Linux,Mac filename messageService.cpp.pdf
operating system Ubunut,Linux,Mac filename messageService.cpp.pdf
 
Classes function overloading
Classes function overloadingClasses function overloading
Classes function overloading
 
FUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptxFUNCTIONS, CLASSES AND OBJECTS.pptx
FUNCTIONS, CLASSES AND OBJECTS.pptx
 
OOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptxOOP-Lecture-05 (Constructor_Destructor).pptx
OOP-Lecture-05 (Constructor_Destructor).pptx
 
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
 
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
 
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
 
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.pdfAssignment is Page 349-350 #4 and #5 Use the Linked Lis.pdf
Assignment is Page 349-350 #4 and #5 Use the Linked Lis.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
 
Frequency .java Word frequency counter package frequ.pdf
Frequency .java  Word frequency counter  package frequ.pdfFrequency .java  Word frequency counter  package frequ.pdf
Frequency .java Word frequency counter package frequ.pdf
 
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
 
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.pdfTask #1 Correcting Logic Errors in FormulasCopy and compile the so.pdf
Task #1 Correcting Logic Errors in FormulasCopy and compile the so.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
 
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
 
Oops presentation
Oops presentationOops presentation
Oops presentation
 
#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
 
Virtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.pptVirtual Function and Polymorphism.ppt
Virtual Function and Polymorphism.ppt
 
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
 

More from sales87

Using Martelle�s Chapters 12-14, please describe the impact of WWII .pdf
Using Martelle�s Chapters 12-14, please describe the impact of WWII .pdfUsing Martelle�s Chapters 12-14, please describe the impact of WWII .pdf
Using Martelle�s Chapters 12-14, please describe the impact of WWII .pdf
sales87
 
Using htmljscss, recreate the sliders. I have attached all images..pdf
Using htmljscss, recreate the sliders. I have attached all images..pdfUsing htmljscss, recreate the sliders. I have attached all images..pdf
Using htmljscss, recreate the sliders. I have attached all images..pdf
sales87
 
using financial calculatorusing fi.pdf
using financial calculatorusing fi.pdfusing financial calculatorusing fi.pdf
using financial calculatorusing fi.pdf
sales87
 
Using a Blackjack game that has the classesentities Blackjack, Card.pdf
Using a Blackjack game that has the classesentities Blackjack, Card.pdfUsing a Blackjack game that has the classesentities Blackjack, Card.pdf
Using a Blackjack game that has the classesentities Blackjack, Card.pdf
sales87
 
Using an Arduino microcontroller to code the following projectDet.pdf
Using an Arduino microcontroller to code the following projectDet.pdfUsing an Arduino microcontroller to code the following projectDet.pdf
Using an Arduino microcontroller to code the following projectDet.pdf
sales87
 
Use the internet to find an example of a chart or graph.Insert an .pdf
Use the internet to find an example of a chart or graph.Insert an .pdfUse the internet to find an example of a chart or graph.Insert an .pdf
Use the internet to find an example of a chart or graph.Insert an .pdf
sales87
 
Use The Wobblies video as a guide httpswww.youtube.comwatchv.pdf
Use The Wobblies video as a guide httpswww.youtube.comwatchv.pdfUse The Wobblies video as a guide httpswww.youtube.comwatchv.pdf
Use The Wobblies video as a guide httpswww.youtube.comwatchv.pdf
sales87
 
Use the singly linked list class introduced in the lab to implement .pdf
Use the singly linked list class introduced in the lab to implement .pdfUse the singly linked list class introduced in the lab to implement .pdf
Use the singly linked list class introduced in the lab to implement .pdf
sales87
 
Use the Plan X and Plan Y tax schemes to complete the following tabl.pdf
Use the Plan X and Plan Y tax schemes to complete the following tabl.pdfUse the Plan X and Plan Y tax schemes to complete the following tabl.pdf
Use the Plan X and Plan Y tax schemes to complete the following tabl.pdf
sales87
 
Use the pervious question to answer question 4. Suppose that in car.pdf
Use the pervious question to answer question 4.  Suppose that in car.pdfUse the pervious question to answer question 4.  Suppose that in car.pdf
Use the pervious question to answer question 4. Suppose that in car.pdf
sales87
 
Use the information below to Developdraw a Systemigram for enviro.pdf
Use the information below to Developdraw a Systemigram for enviro.pdfUse the information below to Developdraw a Systemigram for enviro.pdf
Use the information below to Developdraw a Systemigram for enviro.pdf
sales87
 
Use the phylogeny below to determine whether each statement is true .pdf
Use the phylogeny below to determine whether each statement is true .pdfUse the phylogeny below to determine whether each statement is true .pdf
Use the phylogeny below to determine whether each statement is true .pdf
sales87
 
Use the input function to ask the user for a positive, whole number..pdf
Use the input function to ask the user for a positive, whole number..pdfUse the input function to ask the user for a positive, whole number..pdf
Use the input function to ask the user for a positive, whole number..pdf
sales87
 
Use este estudio de caso para responder las siguientes preguntas. .pdf
Use este estudio de caso para responder las siguientes preguntas. .pdfUse este estudio de caso para responder las siguientes preguntas. .pdf
Use este estudio de caso para responder las siguientes preguntas. .pdf
sales87
 
Usar su autoridad y poder formal para resolver un conflicto, mientra.pdf
Usar su autoridad y poder formal para resolver un conflicto, mientra.pdfUsar su autoridad y poder formal para resolver un conflicto, mientra.pdf
Usar su autoridad y poder formal para resolver un conflicto, mientra.pdf
sales87
 
Usando la teor�a de la expectativa de la motivaci�n como marco para .pdf
Usando la teor�a de la expectativa de la motivaci�n como marco para .pdfUsando la teor�a de la expectativa de la motivaci�n como marco para .pdf
Usando la teor�a de la expectativa de la motivaci�n como marco para .pdf
sales87
 
Usando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdf
Usando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdfUsando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdf
Usando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdf
sales87
 
URGENTAssignment 3 - Software DesginPauline is considering how.pdf
URGENTAssignment 3 - Software DesginPauline is considering how.pdfURGENTAssignment 3 - Software DesginPauline is considering how.pdf
URGENTAssignment 3 - Software DesginPauline is considering how.pdf
sales87
 
Uscinski and his co-authors describe how belief in political conspir.pdf
Uscinski and his co-authors describe how belief in political conspir.pdfUscinski and his co-authors describe how belief in political conspir.pdf
Uscinski and his co-authors describe how belief in political conspir.pdf
sales87
 
Uno de los beneficios del estado de flujos de efectivo es que ayuda .pdf
Uno de los beneficios del estado de flujos de efectivo es que ayuda .pdfUno de los beneficios del estado de flujos de efectivo es que ayuda .pdf
Uno de los beneficios del estado de flujos de efectivo es que ayuda .pdf
sales87
 

More from sales87 (20)

Using Martelle�s Chapters 12-14, please describe the impact of WWII .pdf
Using Martelle�s Chapters 12-14, please describe the impact of WWII .pdfUsing Martelle�s Chapters 12-14, please describe the impact of WWII .pdf
Using Martelle�s Chapters 12-14, please describe the impact of WWII .pdf
 
Using htmljscss, recreate the sliders. I have attached all images..pdf
Using htmljscss, recreate the sliders. I have attached all images..pdfUsing htmljscss, recreate the sliders. I have attached all images..pdf
Using htmljscss, recreate the sliders. I have attached all images..pdf
 
using financial calculatorusing fi.pdf
using financial calculatorusing fi.pdfusing financial calculatorusing fi.pdf
using financial calculatorusing fi.pdf
 
Using a Blackjack game that has the classesentities Blackjack, Card.pdf
Using a Blackjack game that has the classesentities Blackjack, Card.pdfUsing a Blackjack game that has the classesentities Blackjack, Card.pdf
Using a Blackjack game that has the classesentities Blackjack, Card.pdf
 
Using an Arduino microcontroller to code the following projectDet.pdf
Using an Arduino microcontroller to code the following projectDet.pdfUsing an Arduino microcontroller to code the following projectDet.pdf
Using an Arduino microcontroller to code the following projectDet.pdf
 
Use the internet to find an example of a chart or graph.Insert an .pdf
Use the internet to find an example of a chart or graph.Insert an .pdfUse the internet to find an example of a chart or graph.Insert an .pdf
Use the internet to find an example of a chart or graph.Insert an .pdf
 
Use The Wobblies video as a guide httpswww.youtube.comwatchv.pdf
Use The Wobblies video as a guide httpswww.youtube.comwatchv.pdfUse The Wobblies video as a guide httpswww.youtube.comwatchv.pdf
Use The Wobblies video as a guide httpswww.youtube.comwatchv.pdf
 
Use the singly linked list class introduced in the lab to implement .pdf
Use the singly linked list class introduced in the lab to implement .pdfUse the singly linked list class introduced in the lab to implement .pdf
Use the singly linked list class introduced in the lab to implement .pdf
 
Use the Plan X and Plan Y tax schemes to complete the following tabl.pdf
Use the Plan X and Plan Y tax schemes to complete the following tabl.pdfUse the Plan X and Plan Y tax schemes to complete the following tabl.pdf
Use the Plan X and Plan Y tax schemes to complete the following tabl.pdf
 
Use the pervious question to answer question 4. Suppose that in car.pdf
Use the pervious question to answer question 4.  Suppose that in car.pdfUse the pervious question to answer question 4.  Suppose that in car.pdf
Use the pervious question to answer question 4. Suppose that in car.pdf
 
Use the information below to Developdraw a Systemigram for enviro.pdf
Use the information below to Developdraw a Systemigram for enviro.pdfUse the information below to Developdraw a Systemigram for enviro.pdf
Use the information below to Developdraw a Systemigram for enviro.pdf
 
Use the phylogeny below to determine whether each statement is true .pdf
Use the phylogeny below to determine whether each statement is true .pdfUse the phylogeny below to determine whether each statement is true .pdf
Use the phylogeny below to determine whether each statement is true .pdf
 
Use the input function to ask the user for a positive, whole number..pdf
Use the input function to ask the user for a positive, whole number..pdfUse the input function to ask the user for a positive, whole number..pdf
Use the input function to ask the user for a positive, whole number..pdf
 
Use este estudio de caso para responder las siguientes preguntas. .pdf
Use este estudio de caso para responder las siguientes preguntas. .pdfUse este estudio de caso para responder las siguientes preguntas. .pdf
Use este estudio de caso para responder las siguientes preguntas. .pdf
 
Usar su autoridad y poder formal para resolver un conflicto, mientra.pdf
Usar su autoridad y poder formal para resolver un conflicto, mientra.pdfUsar su autoridad y poder formal para resolver un conflicto, mientra.pdf
Usar su autoridad y poder formal para resolver un conflicto, mientra.pdf
 
Usando la teor�a de la expectativa de la motivaci�n como marco para .pdf
Usando la teor�a de la expectativa de la motivaci�n como marco para .pdfUsando la teor�a de la expectativa de la motivaci�n como marco para .pdf
Usando la teor�a de la expectativa de la motivaci�n como marco para .pdf
 
Usando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdf
Usando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdfUsando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdf
Usando Internet o fuentes de bibliotecas, seleccione cuatro organiza.pdf
 
URGENTAssignment 3 - Software DesginPauline is considering how.pdf
URGENTAssignment 3 - Software DesginPauline is considering how.pdfURGENTAssignment 3 - Software DesginPauline is considering how.pdf
URGENTAssignment 3 - Software DesginPauline is considering how.pdf
 
Uscinski and his co-authors describe how belief in political conspir.pdf
Uscinski and his co-authors describe how belief in political conspir.pdfUscinski and his co-authors describe how belief in political conspir.pdf
Uscinski and his co-authors describe how belief in political conspir.pdf
 
Uno de los beneficios del estado de flujos de efectivo es que ayuda .pdf
Uno de los beneficios del estado de flujos de efectivo es que ayuda .pdfUno de los beneficios del estado de flujos de efectivo es que ayuda .pdf
Uno de los beneficios del estado de flujos de efectivo es que ayuda .pdf
 

Recently uploaded

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
Kartik Tiwari
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 

Recently uploaded (20)

Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
Chapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdfChapter -12, Antibiotics (One Page Notes).pdf
Chapter -12, Antibiotics (One Page Notes).pdf
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 

Use the code below from the previous assignment that we need to exte.pdf

  • 1. Use the code below from the previous assignment that we need to extend just follow the instructions above. ***Make sure after you are done to show the output of your results*** 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
  • 2. 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() {
  • 3. 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
  • 4. 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);
  • 5. 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;
  • 6. 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) {
  • 7. // 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; }
  • 8. // 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.