0% found this document useful (0 votes)
46 views1 page

OOP Lab Assignment: Rectangle & Date Classes

This lab assignment involves creating two classes - Rectangle and Date. For Rectangle, students must create a class with length and width data members and three constructors, as well as a method to calculate area. For Date, the class contains private month, year, and day data members, with three constructors and a display method. Students will create objects for each class using the different constructors and get user input to display valid date values.

Uploaded by

Dania Arshad
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)
46 views1 page

OOP Lab Assignment: Rectangle & Date Classes

This lab assignment involves creating two classes - Rectangle and Date. For Rectangle, students must create a class with length and width data members and three constructors, as well as a method to calculate area. For Date, the class contains private month, year, and day data members, with three constructors and a display method. Students will create objects for each class using the different constructors and get user input to display valid date values.

Uploaded by

Dania Arshad
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

COMSATS University Islamabad, Wah Campus

Lab Assignment # 2
Department of Computer Science

Program/Class: BSE 3A Date: 16 March 2022


Subject: Object Oriented Programming Instructor: Samia Zaffar
_______________________________________________________________________

Classes, Objects and Constructors [CLO2]

Lab Assignment:

Activity 1:
Create a class Rectangle. It has two data members that represent the length and width of
rectangle. Create three constructors (no argument, parametrized and copy constructor).The
method calculateArea() will return the area of rectangle. The runner class will create an objects of
Rectangle class and area function will be called.

Activity 2:
Write a class Date. As date is composed of three attributes, namely month, year and day; so the
class contains three private Data Members. Create three constructors (no argument, parametrized
and copy constructor) and method display().Create three date objects using constructors and get
user input and display valid date values.

You might also like