top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

Design a library shelf which can store books or digital media also like CD/DVD?

+1 vote
68 views

Design it by using classes and have abstraction and inheritance in them.

posted Sep 16, 2013 by Vinay Shukla

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

we can design a base class which will base for any element to be stored on the shelf bringing in inheritence. Shelf is a separate class having fields to identify allowable types that can be stored on the shelf. Shelf class can contain any collections to allow adding and removing objects from it.

abstract class Base{
.........
}

class Book extends Base implements PrintedMediumInt{
....................
}

Class DVD extends Base implements ElectronicMedia{
....................
}

class Shelf{

ArrayList <Base> collection;
}

Inheritence is used for object creation and shelf uses composition. In addtion object creation can be done via abstract factory. Further extension for CD/DVD/Blueray can be achieved using decorators.

answer Sep 17, 2013 by Arvind Singh
Similar Questions
+1 vote

I have a laptop which wont boot up due to a suspected hard drive gone bad. I would like to be able to boot up this laptop on a bootable CD/DVD and hopefully run some utility to detect or determine if the hard drive on the laptop has gone faulty, can anyone give me recommendations for such a CD/DVD and utility.

Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...