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

Solution CS304P_Lab Exercises

Uploaded by

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

Solution CS304P_Lab Exercises

Uploaded by

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

Solution

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)

Bookshop Name Set Order

Address (location) Get Order

Phone number Confirm Order

list of books Deliver order

Update Inventory (update order)

Payment receive/ collect

Handout Title Upload

No. of topics /chapters Download

Page number Edit

Author Print

Publisher Read

Creation date Write

Modify date Share


Edition View

Course Course code Add information

Course name View Information

Course instructor Edit information

Credit hour Read

Total marks Write

Grading scheme

No. of lectures

Video Video number View / watch


Lectures
Name Record

Duration Upload

Video quality Download

Type Stop
Video URL
Share

Pause

Forward

Reverse

Increase speed

Decrease speed

Increase volume

Decrease volume
playback

Professor Employee ID Teach

Name Develop assignment

Age Solve student’s problems

Gender Develop Quiz

Qualification Develop GDB

Specialization Prepare Exam

Designation Take Exam

Experience Invigilate

Salary Mark papers

No. of taught subjects Mark activities

Give grades

Prepare result

Student Student ID / Roll number Study

Name Give exam

Age Attempt activities

Gender Taking lectures

Student program Write notes

Semester Making time table

CGPA

No. of courses

Course No. of topics Upload


content Names

Topic number Edit

Topic Description View

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>

using namespace std;

class Room

private: //private variables of type float.

float width;

float height;

public:

Room() //Default Constructor

width=0.0; //Default value has been assigned to width

height=0.0; //Default value has been assigned to height

cout<<"Default Constructor is called" <<endl;

cout<<"Height: "<<height<<endl;

cout<<"Width: "<<width<<endl<<endl;

Room(float h) //parametrized Constructor (One argument)

height=h;

width=0.0;

cout<<"One Argument Constructor is called" <<endl;

cout<<"Height: "<<height<<endl;

cout<<"Width: "<<width<<endl<<endl;

Room(float h, float w) //parametrized Constructor (Two argument)

height=h;
width=w;

cout<<"Two Argument Constructor is called" <<endl;

cout<<"Height: "<<height<<endl;

cout<<"Width: "<<width<<endl<<endl;

};

int main()

Room R1, R2(10), R3(20,30);

return 0;

You might also like