Download - tt12T01

Transcript
  • Metropolia 10/08/2015 Object-Oriented Programming Exercise 11 teacher: Pasi Ranne

    1. Implement a Prototype pattern (figure 1). Create an abstract class Shape and con-crete classes (Circle, Square and Rectangle) extending the Shape class. A class ShapeCache which stores shape objects in a Hashtable and returns their clone when requested. Demo class PrototypePatternDemo will use ShapeCache class to get an object Shape. Model output is in figure 2. Use next demo class http://users.metropolia.fi/~pasitr/2015-2016/TX00CH90-3001/tt/12/ratkaisut/T01/PrototypePatternDemo.java .

    Figure 1. Prototype pattern

    Figure 2. Output


Top Related