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
This shall mean that for a Desktop Computer object, there shall be 1 CPU,1 Mouse,1 Keyboard,1 Monitor,2 speakers
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)
Similarly for each Cubicle object, there shall be 4 Desktops and 1 Power supply object
Rule : For every 4 cubicles there shall be a one HUB object
The sample 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