University Of Sargodha 2025 OOP Object Oriented Programming BSIT Subjective Part
Discussion
Ask a question about this paper, or help someone else with theirs. Answers are emailed to whoever asked.
No questions yet — be the first to ask.
More Object Oriented Programming papers
See all
Object Oriented Programming AD/ADP/BS 2 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 2 months ago · by Jaweria Gull
Download ↓
Object Oriented Programming AD/ADA/BS 2 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 4 months ago
Download ↓
Object Oriented Programming Msc IT 2 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 10 months ago
Download ↓
University of Sargodha AD/BS 2nd Semester (F-24) Examination 2025 Paper: Object Oriented Programming (CMPC-5202)
Uploaded 11 months ago
Download ↓
University of Sargodha AD/BS 2"d Semester (F-24) Examination 2025 Subject: CSAT/SE Paper: Object Oriented Programming (CMPC-5202)
Uploaded 11 months ago
Download ↓
Object Oriented Programming ADP 3 Semester/Term University Of Sargodha (UOS) 2025
Uploaded 1 year ago
Download ↓
Paper text
University or Sargodha
l)eparttiient or
PIWI". ()biect Oriented Code;CM1'C-5202 Time 1.5
Section: Reg+ SS14SS2 semester: 2nd
Max Marks: 20
Exam: Mid Term , spring 2025
Marks:5
Questiop Nol
CLO-I
Imagine a publishing company that markets both book and audiocassette
versions of its works. Create a class publication that stores the title (a string)
and price (type float) Of a publication. From this class derive two classes:
book, which adds a page count (type int), and tape, which adds a playing time
(jn minutes (type float). Each of these three classes should have a getdata()
timction to get its data from the user at the keyboard, and a putdata() function
to display its data. Write a main() program to test the book and tape classes
by creating instances ofthem, asking the user to fill in data with getdata(), and
then displaying the data With putdata().
Create a class that includes a data member that holds a "serial number" for
each object created from the class. That is, the first object created will be
numbered 1, the second 2, and so on. To do this, you'll need another data
member that records a count of how many objects have been created so far.
(This member should apply to the class as a whole; not to individual objects.
What keyword specifies this?) Then, as each object is created, its constructor
can examine this count member variable to determine the appropriate serial
number for the new object. Add a member function that permits an object to
report its own serial number. Then write a main() program that creates three
objects and queries each one about its serial number. They should respond I
am object number 2, and so on.
ucstion N03
CLOS
Marks:5
Write a program that substitutes an overloaded += operator for the overloaded
+ operator in the SPI'RPLUS program in this chapter. This operator should
allow statements like sl += s2; where s2 is added (concatenated) to sl and the
result is left in s!. The operator should also permit the results of the operation
Cho be used in other calculations, as in s3—sI += s2;
ustadni.com