Professional Documents
Culture Documents
Object Oriented Programming Lab: Instructions
Object Oriented Programming Lab: Instructions
Instructions:
Objective:
To understand the functionality usage and working of copy constructor and operator over loading.
You went for shopping for your upcoming university function and have bought many items; a shirt, a tie
etc for different prices but you found that no item could be less than 100 PKR due to day to day increase
in prices.
Implement a class Product that can store the price for each item purchased. Implement the following
member function in your class
• Default constructor
• Parameterized constructor
• Copy constructor
• Getter and Setter
Destructor
Compute and return the sum of the items with the help of a global function which receives two
parameters an array of Product type and total number of products.
Test the functionality of your class by creating an array of Product in main method.
Implement a Circle class. Each object of this class will represent a circle, storing its radius and the x and
y coordinates of its center as floats.
Include all access functions, an area() function to calculate the area of the circle which is equal to πr 2.
Void BigestCircle(Circle obj[],int size); //print the radius, area and coordinate of the biggest circle
Void SmallestCircle(Circle obj[],int size); //print the radius, area and coordinate of the biggest circle
Test the functionality of your created class. Create an array of circle of size 10 in main method. Set radius
and x, y point of each object.
Create a class Fractions that have numerator and denominator as its integer members and perform
following tasks.
Best of Luck