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

Object Oriented Programming Lab 01 Topic Covered: Classes and Objects

The document provides instructions to create Circle and Rectangle classes with attributes and functions. The Circle class has radius, x and y coordinates attributes and functions to set, get, show area and circumference. The Rectangle class has length and width attributes and functions to set, get, perimeter, area and draw the rectangle.

Uploaded by

Lovely Jutt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Object Oriented Programming Lab 01 Topic Covered: Classes and Objects

The document provides instructions to create Circle and Rectangle classes with attributes and functions. The Circle class has radius, x and y coordinates attributes and functions to set, get, show area and circumference. The Rectangle class has length and width attributes and functions to set, get, perimeter, area and draw the rectangle.

Uploaded by

Lovely Jutt
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Object Oriented Programming

Lab 01
Topic Covered: Classes and Objects
Q1. Make a Circle class.
a. It has three attributes radius, the x and the y coordinates of
its center of double data type.
b. Make void set(double, double, double) functions to set x, y and
radius.
c. Make void get() functions to get x, y and radius from user.
d. Make void show() function to display x , y coordinates and radius
of a circle.
e. Make double area() function, and a double circumference()
function to calculate and return area and circumference.
f. Call these functions in main() to test their working.
This is the output of program

Q2. Make a Rectangle class.


a. It has two attributes length, and width of int data type.
b. Make two member functions int perimeter() and int area() to
calculate and return perimeter and the area of a rectangle.
c. Make void set( int l, int w) and void get() functions to change
the length and width attributes.
d. Make a void draw() function that draws a rectangle using a
character * on console.
*********
* *
* *
*********

This is the output of program

You might also like