0% found this document useful (0 votes)
191 views

Object Oriented Programming (Lab) Assignment # 2: Instructions

This document outlines a 3-task assignment for an Object Oriented Programming lab course. Task 1 involves creating a PlotsRecord class with member variables and functions to get, set, and display plot data. Task 2 involves declaring an array of Person objects with attributes and functions to show details of persons between ages 20-30 who are male. Task 3 involves demonstrating that destructors execute in reverse order of constructors by creating an array of objects and observing constructor/destructor execution order. Screenshots of code and output are required for all tasks.

Uploaded by

ali yousaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
191 views

Object Oriented Programming (Lab) Assignment # 2: Instructions

This document outlines a 3-task assignment for an Object Oriented Programming lab course. Task 1 involves creating a PlotsRecord class with member variables and functions to get, set, and display plot data. Task 2 involves declaring an array of Person objects with attributes and functions to show details of persons between ages 20-30 who are male. Task 3 involves demonstrating that destructors execute in reverse order of constructors by creating an array of objects and observing constructor/destructor execution order. Screenshots of code and output are required for all tasks.

Uploaded by

ali yousaf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

The University of Lahore, CS&IT Department

Object Oriented Programming (Lab)


Assignment # 2
Start Date: 28/10/2020 Section: C Total Marks: 15
Due Date: 04/11/2020 Program: BSCS
Instructions
1. Understanding of the problems is part of the assignments. So no query please.
2. All students of OOP Section C are requested to upload soft copy of solution on slate
and submit the hard copy of solution in Lab
3. Mention your full name, registration and section on front page
4. viva will be conducted on submission
5. assignment must not be hand written only computer printed
6. You will get Zero marks if found any type of cheating.
7. No submission after due date. This is individual assignment

Task 1:
Write a C++ program that uses a class named PlotsRecord. Also attach screen shot of the
output [10]
 The class has following member variables
Plot_Number
Block
Society_Name
Owned_By

 The class has following member functions


SetData() which will take input from user and set values of all member
variables
ShowData() which will display all values of member variables
RetPlotNo() which will return the plot number of a plot.
RetBlock() which will return the block (A/B/C) of a plot.

get_record() that input the data of each object


Displa_ record() that displays the data of each object
Write a main code to Test your program and attach the screen shot of code as well as
output with your assignment.

Task 2:
Declare an array named “Person” with three attributes/data members. Declare an array of size
50. Also call their setter /getters of class. Also define a function named void
showPersonDeatails(), which shows the details of those Persons who are between age 20 to
30 and having male gender.
Note:
- ID, is automatically assigned to newly created object by calling default Constructor
-each data member of class has its own setter and getter
-all getter must be constant member function
Test your program and attach the screen shot of code as well as output with your
assignment.

Task 3:
Write a code to prove that execution of destructor is reverse of execution of constructors. e.g
we declare an array of 5 objects say
Int main()
{
Person q[5];
}
the constructor of t[0] excutes first and destructor of t[0] executes at last.
Test your program and attach the screen shot of code as well as output with your
assignment.

You might also like