CS201 Assignment No.3 Solution Fall 2022

0

Vu All Subjects Assignment Quiz GDB Handouts Available here 

Aslam U Alaikum!

Dear Students

In this post we are providing you CS201 assignment 3 solution Fall 2022 100% correct or right solution. You’ll Download assignment Solution File From below download (Click Here For Download File)) link interface.

You should never copy paste the same answer which we are providing. Please do make some changes in the solution file.

Answer 

#include<iostream>

using namespace std;

class Employee

{

private:

string emp_Id;

string emp_Name;

int joiningYear;

int joiningMonth;

int joiningDate;

public:

Employee()

{

emp_Id = "<<EMPTY>>";

emp_Name = "<<EMPTY>>";

joiningYear=0;

joiningMonth=0;

joiningDate=0;

}

Employee(string id, string name, int year, int month, int date)

{

emp_Id = id;

emp_Name = name;

joiningYear=year;

joiningMonth=month;

joiningDate=date;

}

void setValues(Employee *emp2)

{

emp_Id = emp2->emp_Id;

emp_Name = emp2->emp_Name;

joiningYear=emp2->joiningYear;

joiningMonth=emp2->joiningMonth;

joiningDate=emp2->joiningDate;

}

string getId()

{

return emp_Id;

}

string getName()

{

return emp_Name;

}

int getYear()

{

return joiningYear;

}

int getMonth()

{

return joiningMonth;

}

int getDate()

{

return joiningDate;

}

void display(Employee emp)

{

cout<<"ID: "<<emp.getId()<<"\n";

cout<<"Name: "<<emp.getName()<<"\n";

cout<<"Joining Year: "<<emp.getYear()<<"\n";

cout<<"Joining Month: "<<emp.getMonth()<<"\n";

cout<<"Joining Date: "<<emp.getDate()<<"\n";

}

};

int main()

{

cout<<"```````````````````````````"<<"\n";

cout<<"vuonlinehelp.blogspot.com"<<"\n";

cout<<"```````````````````````````"<<"\n";

Employee emp1;

Employee emp2("his vu id ", "his name", 2002,11,06);

cout<<"Employee 1 Using default Constructor:"<<"\n";

emp1.display(emp1);

cout<<"Employee 2 Using Parameterized constructor:"<<"\n";

emp2.display(emp2);

cout<<"Employee 1 having Employee 2 copied data member values"<<"\n";

emp1.setValues(&emp2);

emp1.display(emp1);

return 0;

}

If you appreciate our work, please share our website vuonlinehelp.blogspot.com with your friends.


We are here to provide Latest Virtual University Assignment Solutions, GDB Solutions, Quiz Solution, Midterm Past Papers, and Final term Past Papers in this website.

Post a Comment

0Comments

Thanks everone

Post a Comment (0)