SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Downloaden Sie, um offline zu lesen
Rewrite the printInfo() functions of the Employee and Department classes by overloading the
put-to operator Operator<<.
C++
class Employee {
private:
string ID;
string name;
string jobTitle;
bool isManager;
string ID_of_Dept;
public:
void printInfo();
};
void Employee::printInfo() {
cout << "t" << ID << "|" << name << " | " << jobTitle << " | " << isManager << " | " <<
ID_of_Dept << "n";
}
class Department {
private:
string ID;
string name;
string loc;
string ID_of_manager;
vector listOfEmp_IDs;
public:
void printInfo();
};
void Department::printInfo() {
cout << ID << " | " << name << " | " << loc << " | Manager:" << ID_of_manager << endl;
cout << "List of emp IDs:n";
}
void main()
{
vector emp_list;
vector dept_list;
readEmployeesFromFile(emp_list);
readDepartmentsFromFile(dept_list);
//print out department info
for (int d = 0; d < dept_list.size(); d++) {
dept_list[d].printInfo();
//1. for each depertment get me the list of emp_IDs.
vector _listOfEmp_IDs = dept_list[d].get_listOfEmp_IDs();
//2. for each emp ID, get its index in the emp_list
for (int e = 0; e < _listOfEmp_IDs.size(); e++) {
int idx = findEmpIdxByID(/*which list to search in?*/ emp_list,
_listOfEmp_IDs[e]);
//3. print out the emp info
emp_list[idx].printInfo();
}
cout << "n-----------------------------------------------n";
}
}

Weitere ähnliche Inhalte

Ähnlich wie Rewrite the printInfo() functions of the Employee and Department cla.pdf

Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
jhe04
 
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxPart APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
dewhirstichabod
 
school-management-by-shivkamal-singh.pdf
school-management-by-shivkamal-singh.pdfschool-management-by-shivkamal-singh.pdf
school-management-by-shivkamal-singh.pdf
ashishkum805
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
AidIQ
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
kavithaarp
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
Rajeev Sharan
 

Ähnlich wie Rewrite the printInfo() functions of the Employee and Department cla.pdf (20)

computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)computer project code ''payroll'' (based on datafile handling)
computer project code ''payroll'' (based on datafile handling)
 
Basic Sql Handouts
Basic Sql HandoutsBasic Sql Handouts
Basic Sql Handouts
 
BIS05 Introduction to SQL
BIS05 Introduction to SQLBIS05 Introduction to SQL
BIS05 Introduction to SQL
 
C++ Functions.ppt
C++ Functions.pptC++ Functions.ppt
C++ Functions.ppt
 
power point presentation on object oriented programming functions concepts
power point presentation on object oriented programming functions conceptspower point presentation on object oriented programming functions concepts
power point presentation on object oriented programming functions concepts
 
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxPart APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
 
12th CBSE Practical File
12th CBSE Practical File12th CBSE Practical File
12th CBSE Practical File
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
school-management-by-shivkamal-singh.pdf
school-management-by-shivkamal-singh.pdfschool-management-by-shivkamal-singh.pdf
school-management-by-shivkamal-singh.pdf
 
Pratik Bakane C++
Pratik Bakane C++Pratik Bakane C++
Pratik Bakane C++
 
Operator overloading2
Operator overloading2Operator overloading2
Operator overloading2
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
 
C++ manual Report Full
C++ manual Report FullC++ manual Report Full
C++ manual Report Full
 
C++ lab assignment
C++ lab assignmentC++ lab assignment
C++ lab assignment
 
This what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdfThis what Im suppose to do and this is what I have so far.In thi.pdf
This what Im suppose to do and this is what I have so far.In thi.pdf
 
Advance C++notes
Advance C++notesAdvance C++notes
Advance C++notes
 
OOPS 22-23 (1).pptx
OOPS 22-23 (1).pptxOOPS 22-23 (1).pptx
OOPS 22-23 (1).pptx
 
Rajeev oops 2nd march
Rajeev oops 2nd marchRajeev oops 2nd march
Rajeev oops 2nd march
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdfC++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 

Mehr von alertshoeshingkimand

Share your results from taking Organizational Culture Assessment Ins.pdf
Share your results from taking Organizational Culture Assessment Ins.pdfShare your results from taking Organizational Culture Assessment Ins.pdf
Share your results from taking Organizational Culture Assessment Ins.pdf
alertshoeshingkimand
 
Sessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdf
Sessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdfSessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdf
Sessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdf
alertshoeshingkimand
 
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
SENDER  It is a helmet that contains a sensor for gases, vital s.pdfSENDER  It is a helmet that contains a sensor for gases, vital s.pdf
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
alertshoeshingkimand
 
September 21, 2022Russia�s war against Ukraine is causing tremendo.pdf
September 21, 2022Russia�s war against Ukraine is causing tremendo.pdfSeptember 21, 2022Russia�s war against Ukraine is causing tremendo.pdf
September 21, 2022Russia�s war against Ukraine is causing tremendo.pdf
alertshoeshingkimand
 

Mehr von alertshoeshingkimand (20)

Ships provide maritime transport services but emit polluting gases s.pdf
Ships provide maritime transport services but emit polluting gases s.pdfShips provide maritime transport services but emit polluting gases s.pdf
Ships provide maritime transport services but emit polluting gases s.pdf
 
Short essayThe next step in effective argumentation is the ability.pdf
Short essayThe next step in effective argumentation is the ability.pdfShort essayThe next step in effective argumentation is the ability.pdf
Short essayThe next step in effective argumentation is the ability.pdf
 
Share your results from taking Organizational Culture Assessment Ins.pdf
Share your results from taking Organizational Culture Assessment Ins.pdfShare your results from taking Organizational Culture Assessment Ins.pdf
Share your results from taking Organizational Culture Assessment Ins.pdf
 
Seth named his wife, Monique, who is age 57, as the sole beneficiary.pdf
Seth named his wife, Monique, who is age 57, as the sole beneficiary.pdfSeth named his wife, Monique, who is age 57, as the sole beneficiary.pdf
Seth named his wife, Monique, who is age 57, as the sole beneficiary.pdf
 
se�or. y se�ora Una vez que ambos tienen 62 a�os, presentan una decl.pdf
se�or. y se�ora Una vez que ambos tienen 62 a�os, presentan una decl.pdfse�or. y se�ora Una vez que ambos tienen 62 a�os, presentan una decl.pdf
se�or. y se�ora Una vez que ambos tienen 62 a�os, presentan una decl.pdf
 
Sessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdf
Sessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdfSessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdf
Sessizlik, Damgalanma ve Akl Hastal Madeline Halpert ve Eva Rosenfel.pdf
 
Set residents strategy to always defect and invaders strategy to t.pdf
Set residents strategy to always defect and invaders strategy to t.pdfSet residents strategy to always defect and invaders strategy to t.pdf
Set residents strategy to always defect and invaders strategy to t.pdf
 
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
SENDER  It is a helmet that contains a sensor for gases, vital s.pdfSENDER  It is a helmet that contains a sensor for gases, vital s.pdf
SENDER It is a helmet that contains a sensor for gases, vital s.pdf
 
Service Values1. I build strong relationships and create Ritz-Carl.pdf
Service Values1. I build strong relationships and create Ritz-Carl.pdfService Values1. I build strong relationships and create Ritz-Carl.pdf
Service Values1. I build strong relationships and create Ritz-Carl.pdf
 
send SERIALWISE with headings In F2021, the charity trained 19,591.pdf
send SERIALWISE with headings In F2021, the charity trained 19,591.pdfsend SERIALWISE with headings In F2021, the charity trained 19,591.pdf
send SERIALWISE with headings In F2021, the charity trained 19,591.pdf
 
September 21, 2022Russia�s war against Ukraine is causing tremendo.pdf
September 21, 2022Russia�s war against Ukraine is causing tremendo.pdfSeptember 21, 2022Russia�s war against Ukraine is causing tremendo.pdf
September 21, 2022Russia�s war against Ukraine is causing tremendo.pdf
 
Self-awareness involves being aware of different aspects of the self.pdf
Self-awareness involves being aware of different aspects of the self.pdfSelf-awareness involves being aware of different aspects of the self.pdf
Self-awareness involves being aware of different aspects of the self.pdf
 
Select one theory from the following categories Sociological Syste.pdf
Select one theory from the following categories Sociological Syste.pdfSelect one theory from the following categories Sociological Syste.pdf
Select one theory from the following categories Sociological Syste.pdf
 
Select one of the scenarios below and address the following Describ.pdf
Select one of the scenarios below and address the following Describ.pdfSelect one of the scenarios below and address the following Describ.pdf
Select one of the scenarios below and address the following Describ.pdf
 
Select all correct statements related to the contribution of scienti.pdf
Select all correct statements related to the contribution of scienti.pdfSelect all correct statements related to the contribution of scienti.pdf
Select all correct statements related to the contribution of scienti.pdf
 
Seleccione todas las afirmaciones que se aplican al proceso de pre.pdf
Seleccione todas las afirmaciones que se aplican al proceso de pre.pdfSeleccione todas las afirmaciones que se aplican al proceso de pre.pdf
Seleccione todas las afirmaciones que se aplican al proceso de pre.pdf
 
Seleccione un tema de liderazgo relevante y de actualidad de los med.pdf
Seleccione un tema de liderazgo relevante y de actualidad de los med.pdfSeleccione un tema de liderazgo relevante y de actualidad de los med.pdf
Seleccione un tema de liderazgo relevante y de actualidad de los med.pdf
 
Seleccione el orden correcto para los siguientes eventos clave en la.pdf
Seleccione el orden correcto para los siguientes eventos clave en la.pdfSeleccione el orden correcto para los siguientes eventos clave en la.pdf
Seleccione el orden correcto para los siguientes eventos clave en la.pdf
 
Security analysis Perform security analysis on your proposed ransom.pdf
Security analysis Perform security analysis on your proposed ransom.pdfSecurity analysis Perform security analysis on your proposed ransom.pdf
Security analysis Perform security analysis on your proposed ransom.pdf
 
Se realiz� un estudio que muestra que el politetrafluoroetileno (PFO.pdf
Se realiz� un estudio que muestra que el politetrafluoroetileno (PFO.pdfSe realiz� un estudio que muestra que el politetrafluoroetileno (PFO.pdf
Se realiz� un estudio que muestra que el politetrafluoroetileno (PFO.pdf
 

Kürzlich hochgeladen

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

Rewrite the printInfo() functions of the Employee and Department cla.pdf

  • 1. Rewrite the printInfo() functions of the Employee and Department classes by overloading the put-to operator Operator<<. C++ class Employee { private: string ID; string name; string jobTitle; bool isManager; string ID_of_Dept; public: void printInfo(); }; void Employee::printInfo() { cout << "t" << ID << "|" << name << " | " << jobTitle << " | " << isManager << " | " << ID_of_Dept << "n"; } class Department { private: string ID; string name; string loc; string ID_of_manager; vector listOfEmp_IDs; public: void printInfo(); }; void Department::printInfo() { cout << ID << " | " << name << " | " << loc << " | Manager:" << ID_of_manager << endl; cout << "List of emp IDs:n"; }
  • 2. void main() { vector emp_list; vector dept_list; readEmployeesFromFile(emp_list); readDepartmentsFromFile(dept_list); //print out department info for (int d = 0; d < dept_list.size(); d++) { dept_list[d].printInfo(); //1. for each depertment get me the list of emp_IDs. vector _listOfEmp_IDs = dept_list[d].get_listOfEmp_IDs(); //2. for each emp ID, get its index in the emp_list for (int e = 0; e < _listOfEmp_IDs.size(); e++) { int idx = findEmpIdxByID(/*which list to search in?*/ emp_list, _listOfEmp_IDs[e]); //3. print out the emp info emp_list[idx].printInfo(); } cout << "n-----------------------------------------------n"; } }