You are on page 1of 1

1.

You are asked to create a Parking software design pattern with the following assumptions:
• The parking lot has several levels. Each level has several rows of dots.
• The parking lot can park motorbikes, cars and buses.
• The parking lot has motorbike spots, crowded spots, and large spots.
• Motorcycles can be parked anywhere.
• A car can be parked in one small place or one big place.
• A bus can park in five consecutive large places and in the same row. No can park in a small

In the implementation below, we have created an abstract class Vehicle, which inherits cars,
buses and motorbikes. In order to handle different parking lot sizes, we only has one
ParkingSpot class which has a member variable denoting size

a. Based on question no 1, analyze and describe the implementation of the design pattern
following: (make a diagram)
• Factory Method
• Prototype
• Adapter
b. Based on question no.1, draw a class diagram of the existing system. The class diagram
created has combined the design pattern applied to question no. 1!
2. You are asked to design a computer and are given the following assumptions:
• Computers are made of processors, memory and potential add-on cards (sound...etc),
• A processor is a CPU or accelerator card that will add behavior to an existing CPU,
• The processor must be init (as well as the accelerator card) and have the ability to read / write
from / in memory, to load the program to the address and execute it.
• Memory can be RAM or cache,
• Cache always deals with RAM,
• If there is a cache it is mainly queried by the processor,
• The computer can directly handle up to 3 additional cards,
• To handle a new card, the computer must have an extension board,
• Many sound cards with different behavior exist.

a. Based on question no 2., analyze and describe the implementation of the design pattern
following: (make a diagram)
• Factory Method
• Prototype
• Adapter

b. Based on question no.2, draw a class diagram of the existing system. Class the diagram that
has been made has combined the design pattern applied to question no. 2!

You might also like