Object Oriented PROGRAMMING (CS217)
ASSIGNMENT-
Instructions
Write complete programs for the following. You are free to consult each other for verbal help.
However copying or sharing the code with each other will not only result into the
cancellation of the current assignment, it may impact your grade in all the assignments and
exams as well.
Due: May, 02 2021
1. Create a class Shape and inherit Triangle, Rectangle, Square classes from it, having
appropriate attributes (length, width, height). Shape class should have a single function to
calculate the area, and a single function for perimeter of the shape calling it.
2. A publishing company markets both book and audiocassette versions of its works. Create
a class publication that stores the title and price of a publication. From this class derive
two classes: book, which adds a page count, and tape, which adds a playing time in
minutes. Each of these three 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 and tape classes.
3. Create a class Mobile having Specification attributes and a friend function Compare.
Show a list of available mobiles to the user and compare them to help the user make a
decision to buy the better one. Put some intelligence in your program to predict him
which one is the better phone.
4. Think about a real world example where you can implement friend class’s concept. Your
example should have at least 3 actors. Explain the scenario and implement the menu
driven program.
5. Implement the example below. Add all the functions and attributes as specified. Your
program should be menu driven.