COMP5028 Object Oriented Analysis and Design Semester 2, 2007 1 of 1 Laboratory session Five SIT 115/117 Wednesday September 12, 2007 School of Information Technologies The University of Sydney Objective • Understand the Open-Closed Principle • Improve an initial design to make it closed against certain changes. Tasks A. Read the Shape application in week 8's lecture slides B. Modify the design to make the displayAll function closed to addition of new Shapes, as well as changes of ordering policy. Show piece of important Java code in your design class diagram. C. Write sample codes to test your design. Resources Assume the system will be developed in Java. A few APIs in Java that might help you to design the application is listed below: package java.util; interface Comparator{ public int compare (Object o1, Object o2); pubic boolean equals(Object obj); } class Arrays in java.util contains various methods for manipulating arrays (including sorting and searching) Below are a few sorting methods you might use: public static void sort(Object[] a,Comparator c) public static void sort(Object[] a,int fromIndex, int toIndex,Comparator c) To get more info please check corresponding online Java API document.