
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for a lab exercise in object-oriented programming (oop) for the cs112l course in the faculty of computer science and engineering. Students are required to create classes 'publication', 'sales', 'book', 'tape', and 'disk' for a publishing company that markets book, audiocassette, and computer disk versions of its works. The classes should include member functions getdata() and putdata(), and the 'book', 'tape', and 'disk' classes should be derived from 'publication'. The 'disk' class should also include an enum type for the disk type: cd or dvd.
Typology: Assignments
1 / 1
This page cannot be seen from the preview
Don't miss anything!

CS112L Object Oriented Programming Lab Final
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. Add another base class sales that holds an array of three floats so that it can record the dollar sales of a particular publication for the last three months. From these base classes derive two classes: book , which adds a page count (type int), and tape, which adds a playing time in minutes (type float). Assume that the publisher decides to add a third way to distribute books: on computer disk, for those who like to do their reading on their laptop. Add a disk class that, like book and tape, is derived from publication. The disk class should incorporate the same member functions as the other classes. The data item unique to this class is the disk type: either CD or DVD. Use an enum type to store this item. The user could select the appropriate type by typing c or d. Each of these classes should have a getdata() function 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 , tape and disk classes by creating instances of them and exercise their input/output capabilities.