Object Oriented Programming Lab Manual (Lab 02) : Topic: Basic Class and Setters/Getters
Object Oriented Programming Lab Manual (Lab 02) : Topic: Basic Class and Setters/Getters
Session: s2021
1)
Then write main function and create 3 Employee objects with following information, and display
this information as output on screen.
1. 1, Ali, Sales Person, 10 (id,name,designation,pay scale)
2. 2, Babar, Manager, 17
3. 3, Sarwar, IT Administrator, 16
2)
Create other 3 Employee objects and take these three employees information from user, and
display this information as output on screen.
3) update the designaton of Babar from manager to sale person and also update his pay scale
from 17 to 10. And display updated babar information on screen.
Task02
a)You have to create a class Date that has 3 private member variables to store following three
attributes:
day (int)
month (int)
years (int)
b) Implement the getter and setter functions for each of the above three member variables.
Names of these functions setDay, setMonth, setYear, getDay, getMonth,getYear with proper
checks.
c) Implement a public member function displayDate of the Date class. This function should
display the date in the following format. For example, the date 15th March 2016 should be
displayed on screen like 15/03/2016
e) Write a main function to test the working of Date class and its member functions.
f) In the main function, create 5 Date objects. Store these five dates in these Date objects:
25-12-1876
9-11-1877
21-08-1938
14-08-1947
11-03-1948
(Note: use setters functions to set the date values)
Now, print these five dates by calling the appropriate member function of the Date class.
(Note: use getters functions to display in main functions)