Lab 7 OOP Abeeha
Lab 7 OOP Abeeha
REGISTRATION NO FA23-EEE-050
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