Solution CS304P_Lab Exercises
Solution CS304P_Lab Exercises
Lab 01
Problem Statement
Consider the following scenario and identify all objects, their attributes and behaviors.
In Virtual University bookshop, the handouts of all courses are provided at reasonable price.
The handouts are made in accordance with the video lectures recorded by famous professors. It
is a step to facilitate students to easily digest the course contents.
Solution:
Objects Attributes (characteristics) Behaviors (operations)
Author Print
Publisher Read
Grading scheme
No. of lectures
Duration Upload
Type Stop
Video URL
Share
Pause
Forward
Reverse
Increase speed
Decrease speed
Increase volume
Decrease volume
playback
Experience Invigilate
Give grades
Prepare result
CGPA
No. of courses
Composed by Share
Publish by Write
Written by Download
Lab 02
Problem Statement
In the below diagram, we have two different types of file classes (PDF and Video). You are
required to apply the concept of generalization to the given classes and draw a class diagram
showing this generalization relationship.
Solution:
Lab 03
Problem Statement
Write a program which consists of a class named Room having two data members Height and Width,
the class should also consist of three constructors i.e., Default constructor, one argument constructor
and two arguments constructor.
Sample Output
After running your program, the following screen should display.
Solution:
#include<iostream>
class Room
float width;
float height;
public:
cout<<"Height: "<<height<<endl;
cout<<"Width: "<<width<<endl<<endl;
height=h;
width=0.0;
cout<<"Height: "<<height<<endl;
cout<<"Width: "<<width<<endl<<endl;
height=h;
width=w;
cout<<"Height: "<<height<<endl;
cout<<"Width: "<<width<<endl<<endl;
};
int main()
return 0;