views:

22

answers:

0

I need to develop a certain sw module which outputs the data in the following format Main object and related object and Quantity

i.e

Desktop Computer
---- CPU 1x
---- Mouse 1x ---- KB 1x
---- Monitor 1x
---- Speakers 2x

Cubicles 
       ---------- Desktop Comps        4x (shall mean each cubicle shall contain 4 pc's)
       ---------- Power Supply         1x (shall mean each cubicle shall have a main pow. supply) 

Rule : For every 4 cubicles there shall be a Hive, add one HUB object

Example Output for 8 cubicles shall be 

   Total CPU's  - 32 
   HUB          -  2
   Mouse        - 32
   KB           - 32            
   Monitor      - 32         
   Speakers     - 64
   Cubicles     - 8
   Desktop PC's - 32
   Pow. Supply  - 8

Can anyone help me in realizing the same in terms of OOP classes/interfaces ? Or a pointer to a design pattern to use in such situations.

Deeply appreciate your time for the same