Vous êtes sur la page 1sur 1

Assignment

# 2
OOAD Spring 2016
Deadline: Wednesday, May 25th 2016
Imagine you are designing a system, which helps investors to find and
analyze information regarding different listed companies all across the
world. This system gets some information from other outer sources. If
the GDP of a specific country is needed in a class of your system named
TestForGDP, the system can send a request to one of the 6 available
third party systems for each continent for the GDP of a specific country.
For example, if the GDP of Belgium is required, the system will send a
request to GDPHelperEurope to get the GDP of Belgium.

a) Propose a design using Adapter pattern, which shows a solution
for the above-mentioned problem. You need to elaborate your
design with diagrams. (10)
b) Using the Factory pattern, show how an Adapter is created for this
problem. How will the AdapterFactory class determine which
Adapter to create? Assuming that there will be a
getGDPHelperAdapter () method in your Factory class, write
JAVA code for this method which shows your creation logic. You
can assume that you have a variable countryName and a method
getContinent (String countryName) that returns the
continent of a given country. (10)
c) Using the Singleton pattern, show the initialization of the
AdapterFactory class. (5)

Vous aimerez peut-être aussi