0% found this document useful (0 votes)
22 views11 pages

Lab 7 OOP Abeeha

Uploaded by

alihamzaali0315
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views11 pages

Lab 7 OOP Abeeha

Uploaded by

alihamzaali0315
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

COMSATS UNIVERSITY ISLAMABAD

LAB REPORT NO.7

NAME ABEEHA TAJ KHAN

REGISTRATION NO FA23-EEE-050

SUBJECT OBJECT ORIENTED PROGRAMMING

INVIGILATOR NAYAB GOGOSH

DATE 22 NOVEMBER 2024


LAB TASKS

TASK NO.1
Imagine a publishing company that markets both book and audio-
cassette versions of its works. Create a class publication that
stores the title and price of a publication. a. from this class derives
two classes:
b. Write a main() program to test the book and tape class by
creating instances of them, asking the user to fill in their data with
getdata() and then displaying the data with put data().
Task no.2
Write a class Person that has attributes of id, name and address.
It has a constructor to initialize, a member function to input and a
member function to display data members. Create another class
Student that inherits Person class. It has additional attributes of
roll number and marks. It also has member function to input and
display its data members.
Task no.3
Write a base class Computer that contains data members of word
size(in bits), memory size (in megabytes), storage size (in
megabytes) and speed (in megahertz). Derive a laptop class that
is a kind of computer but also specifies the object’s length, width,
height, and weight. Member functions for both classes should
include a default constructor, a constructor to initialize all
components and a function to display data members.
Home Tasks

Task no.1
Write a program having a base class Student with data members
roll no, name and Class define a member functions getdata() to
input values and another function put data() to display all values.
A class Test is derived from class Student with data members
T1marks, T2marks, T3marks, Sessional1, Sessional2,
Assignment and Final. Also make a function get marks() to enter
marks for all variables except Final and also make a function put
marks() to display result. Make a function Final result() to
calculate value for final variable using other marks. Then display
the student result along with student data.
Task no.2
Task no.3

Task no.4

You might also like