FmD4FRX3FmXvDZXvGZT3FRFgNBP1w326w3z1NBMhNV5=
items

CS201 Assignment 3 Solution Fall 2022

CS201 Assignment 3 Solution Fall 2022

Kindly Changes Wali Jaga Changes zaror karein Assignment Instruction ko
read karein.
Apni ID and Name type krna hai or jis year mai apne campus join keya wo
Year and Date dalni hai
Website: vu expert solutions
YouTube Channel: Vu Expert
#include<iostream>
using namespace std;
class Employee
{
private:
string empId;
string empName;
int joiningYear;
int joiningMonth;
int joiningDate;
public:
Employee()
{
empId = "<<EMPTY>>";
empName = "<<EMPTY>>";
joiningYear=0;
joiningMonth=0;
joiningDate=0;
}
Employee(string id, string name, int year, int month, int date)
{
empId = id;
empName = name;
joiningYear=year;
joiningMonth=month;
joiningDate=date;
}
void setValues(Employee *emp2)
{
empId = emp2->empId;
empName = emp2->empName;
joiningYear=emp2->joiningYear;
joiningMonth=emp2->joiningMonth;
joiningDate=emp2->joiningDate;
}
string getId()
{
return empId;
}
string getName()
{
return empName;
}
int getYear()
{
return joiningYear;
}
int getMonth()
{
return joiningMonth;
}
int getDate()
{
return joiningDate;
}
void display(Employee emp)
{
cout<<"ID: "<<emp.getId()<<endl;
cout<<"Name: "<<emp.getName()<<endl;
cout<<"Joining Year: "<<emp.getYear()<<endl;
cout<<"Joining Month: "<<emp.getMonth()<<endl;
cout<<"Joining Date: "<<emp.getDate()<<endl<<endl;
}
};
int main()
{
Employee emp1;
Employee emp2("VUID", "Your Name", 2019,03,03); (Changes Yaha Karni hai)
cout<<"Employee 1 Using default Constructor:"<<endl;
emp1.display(emp1);
cout<<"Employee 2 Using Parameterized constructor:"<<endl;
emp2.display(emp2);
cout<<"Employee 1 having Employee 2 copied data member values"<<endl;
emp1.setValues(&emp2);
emp1.display(emp1);
return 0;
}

download Pdf 👇
Assignment No.  3 Semester: Spring 2021  CS201 – Introduction to Programming


 


0/Post a Comment/Comments

Partner

73745675015091643