size - number of family member capacity - size of dynamic array family - a partially filled dynamic array of string functions: Person(): default constructor set name to "TBD", and capacity to 3, size to 0, and create family with capacity Person(string): one argument constructor set name, and capacity to 3, size to 0, and create family with capacity Person(string, int): two arg constructor set name, and set capacity using int arg, size to 0, and create family with capacity accessor an accessor for the name variable. mutator - an mutator for the name variable add() add a member to the family grow() - double the capacity of the array cout << endl; Person p("Joe"); p.add("Sarah"); p.add("John"); p.add("Nora"); p.display(); p.add("Nora"); cout << endl; Person p2 = p; p2.setName("Jack"); p2.add("Sam"); no diaplov):

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

C++ Programming Question 1:
Hi, need help with Q1 as I had trouble with big three, thank you.

1. Implement a Person class as specified:
data members:
name name of the Person
size - number of family member
capacity - size of dynamic array
family - a partially filled dynamic array of string
functions:
Person(): default constructor set name to "TBD", and capacity to 3, size to 0,
and create family with capacity
Person(string): one argument constructor set name, and capacity to 3, size to
0, and create family with capacity
Person(string, int): two arg constructor set name, and set capacity using int
arg, size to 0, and create family with capacity
accessor an accessor for the name variable
mutator - an mutator for the name variable
add() - add a member to the family
grow() - double the capacity of the array
display() - output the name of the Person and the names of all family members
Output from the main function above:
Implement the big three for Person class.
Add message for function call.
Name: Joe
Family: Sarah John Nora
Person => Grow function was called
Person => copy constructor was called.
Name: Jack
Family: Sarah John Nora Nora Sam
Person => assignment operator was called.
Name: Kate
Family: Sarah John Nora Nora Sam Tom
final result:
Name: Joe
Family: Sarah John Nora Nora
Name: Jack
Family: Sarah John Nora Nora Sam
Name: Kate
Family: Sarah John Nora Nora Sam Tom
Person => destructor was called.
Person => destructor was called.
Person => destructor was called.
Use following main function to test your program.
int main() {
cout << endl;
}
Person p("Joe");
p.add("Sarah");
p.add("John");
p.add("Nora");
p.display();
p.add("Nora");
cout << endl;
Person p2 = p;
p2.setName("Jack");
p2.add("Sam");
p2.display();
cout << endl;
Person p3;
p3 =p2;
p3.setName("Kate");
p3.add("Tom");
p3.display();
cout<<"\n\nfinal result:"<<endl;
p.display();
p2.display();
p3.display();
cout << endl;
return 0;
Transcribed Image Text:1. Implement a Person class as specified: data members: name name of the Person size - number of family member capacity - size of dynamic array family - a partially filled dynamic array of string functions: Person(): default constructor set name to "TBD", and capacity to 3, size to 0, and create family with capacity Person(string): one argument constructor set name, and capacity to 3, size to 0, and create family with capacity Person(string, int): two arg constructor set name, and set capacity using int arg, size to 0, and create family with capacity accessor an accessor for the name variable mutator - an mutator for the name variable add() - add a member to the family grow() - double the capacity of the array display() - output the name of the Person and the names of all family members Output from the main function above: Implement the big three for Person class. Add message for function call. Name: Joe Family: Sarah John Nora Person => Grow function was called Person => copy constructor was called. Name: Jack Family: Sarah John Nora Nora Sam Person => assignment operator was called. Name: Kate Family: Sarah John Nora Nora Sam Tom final result: Name: Joe Family: Sarah John Nora Nora Name: Jack Family: Sarah John Nora Nora Sam Name: Kate Family: Sarah John Nora Nora Sam Tom Person => destructor was called. Person => destructor was called. Person => destructor was called. Use following main function to test your program. int main() { cout << endl; } Person p("Joe"); p.add("Sarah"); p.add("John"); p.add("Nora"); p.display(); p.add("Nora"); cout << endl; Person p2 = p; p2.setName("Jack"); p2.add("Sam"); p2.display(); cout << endl; Person p3; p3 =p2; p3.setName("Kate"); p3.add("Tom"); p3.display(); cout<<"\n\nfinal result:"<<endl; p.display(); p2.display(); p3.display(); cout << endl; return 0;
Expert Solution
steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education