1. Add Mouse (0) to the list
2. Add Monitor (1) to the list
3. Create a peripheral (ph, 10), which group Mouse and Monitor together, and add to the list.
4. Add CPU (2) to the list
5. Add RAM (3) to the list
6 Create a mother board (mb, 23), which group CPU and RAM together, and add to the list.
7. Add HDD (4) to the list
8. Create a cabinet( cabinet, 423), which group HDD and mb together, and add to the list.
9. Create a computer( computer, 42310), which group cabinet and ph together
-----------------------------------
Add mouse and monitor indivisually
loop 0, 0: Mouse
#0: Mouse
loop 1, 1: Monitor
#1: Monitor
-----------------------------------
Create a new composite: Peri
loop 0, 10: Peri
#0: Mouse
#1: Monitor
-----------------------------------
Add CPU and RAM indivisually
loop 0, 10: Peri
#0: Mouse
#1: Monitor
loop 1, 2: CPU
#2: CPU
loop 2, 3: RAM
#3: RAM
-----------------------------------
Create a new composite: MB (CPU+RAM)
loop 0, 10: Peri
#0: Mouse
#1: Monitor
loop 1, 23: MB
#2: CPU
#3: RAM
-----------------------------------
Add HD indivisually
loop 0, 10: Peri
#0: Mouse
#1: Monitor
loop 1, 23: MB
#2: CPU
#3: RAM
loop 2, 4: HDD
#4: HDD
-----------------------------------
Create a new composite: Cabinet (HD+MB)
loop 0, 10: Peri
#0: Mouse
#1: Monitor
loop 1, 423: Cabinet
#4: HDD
#2: CPU
#3: RAM
-----------------------------------
Create a new composite: Computer (Cabinet+Peri)
loop 0, 42310: Computer
#4: HDD
#2: CPU
#3: RAM
#0: Mouse
#1: Monitor
留言列表