Answer to Question #180606 in C++ for Gaurav kumar

Question #180606

“Smartdata pvt. ltd” company is storing the information of their employees( Name, Department DOB,Gender, address, email and Mob) in different entity according to department of employee. Now, one employee will be shifted from “programing team” to testing team. Write a code to copy all the details of that employee from one object to another object. Note: Display the above concept with the help of classes and copy constructors


1
Expert's answer
2021-04-12T22:53:24-0400
#include<iostream>
using namespace std;
class employees{
public:
    string name,department, dob, gender,address, email,mob;



    public:
    employees(string name,string department,string dob,string gender,string address,string email,string mob) {
    setName(name);
    setDepartment(department);
    setDob(dob);
    setGender(gender);
    setAddress(address);
    setEmail(email);
    setMob(mob);
  }
  void display(string name,string department,string dob,string gender,string address,string email,string mob) {
    cout <<"Name:"<<name<<endl;
    cout <<"Department:"<<department<<endl;
    cout <<"Dob:"<<dob<<endl;
    cout <<"Gender:"<<gender<<endl;
    cout <<"Address:"<<address<<endl;
    cout <<"Email:"<<email<<endl;
    cout <<"Mob:"<<mob<<endl;
  }


    void setName(string name) {
    name = name;
  }
  string getName() {
    return name;
  }
  void setDepartment(string department) {
    department = department;
  }
  string getDepartment() {
    return department;
  }
  void setDob(string dob) {
    dob = dob;
  }
  string getDob() {
    return dob;
  }
//gender
void setGender(string gender) {
    gender = gender;
  }
  string getGender() {
    return gender;
  }
//address
void setAddress(string address) {
    address = address;
  }
  string getAddress() {
    return address;
  }
//email
void setEmail(string email) {
    email = email;
  }
  string getEmail() {
    return email;
  }
//mob
void setMob(string mob) {
    mob = mob;
  }
  string getMob() {
    return mob;
  }
};

int main(){

employees e("test1","CS","3April 1994","Male","test2","test3","888");
e.display("test1","CS","3April 1994","Male","test2","test3","888");


return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS