OOP C++ Assignment

Question

Problem Statement:

 

XYZ is an organization which requires privacy of its employees’ data. For this purpose, an Employee class will be written having following private attributes.

 

‘empId’ of type String         (Write your own student VU id in empId)

‘empName’ of type String   (Write your own name in empName)

‘joiningYear’ of type int      (This will be just the year like 2001,2002,….2022)

‘joiningDate’ of type int      (This will be just the day like 1,2,3….31 NOT the full date as 3/2/2022)

‘joiningMonth’ of type int   (This will be just the month like 1,2,3….12 )

 

For each attribute mentioned above, use setter method to set or update its value and getter method to return its value.

You also need to provide following functions inside the Employee class;

 

 

Default Constructor   (To create an object of Employee class with default values)
Parameterized Constructor  (To create object of Employee class with user’s own attributes values)
setValues(Employee *emp2) (Take an object of Employee class and copy its data members’ values to data members of calling object by using setters)
display(Employee emp)  (Print data member values of emp object using getters)

 

In the main function you have to create and initialize two objects of Employee class using following instructions;

Create first object of Employee class using Default constructor which will initialize the object with some default values.
Create second object of Employee class using Parameterized Constructor and initialize it with your own real values.
Copy the employee 2 object’s data members values to employee 1 object’s data members using setValues(Employee *emp2) function.
Call display() function to print each object’s values as per format shown in following screen shot.

0

Leave an answer