Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
COMP5028 Object Oriented Analysis and Design  Semester 1, 2007 
1 of 1 
 
 
Laboratory Session Seven 
SIT Lab 116/117 
Wednesday 9 May, 2007 
School of Information Technologies 
The University of Sydney 
Design Pattern Practice I 
Objective 
• Recognize particular design pattern based on a given problem description and initial 
design solution. 
• Learn to use java’s collection classes.  
PROBLEM DESCRIPTION 
Organizations often are made up of suborganizations. For example, the government of the 
State of New South Wales includes the University of Sydney, which has three campuses, 
which have many colleges, which are made up of departments, which have labs in them.  
This makes it difficult when you are trying to negotiate a site license with an organization. 
A site license can be for an entire university, or campus, or college, or department, or lab. 
Of course, sometimes people just buy licenses for a single machine or a single person. 
The price of a site license depends on the size of an organization. 
Design a system that can help an employee of an organization tell whether there is a site 
license that covers a particular piece of software, and that can help the organization know 
how many people will be covered by a particular agreement, and thus how much to pay 
for it. 
Make a Party abstract class with subclasses: Individual and Organization. 
Each Party must be able to tell you how many individuals are in it. It will do this by 
communicating with its children. Each Party can have a set of licenses. A Party 
should be able to add and remove licenses. It will also tell whether it is covered for a 
license for a particular piece of software by communicating with its parent. 
TASKS 
1. Answer the following questions: 
a. Which design pattern is applied here?  
b. Why Party is defined as class rather than interface? 
c. What are the common operations between Individual and Organization? 
 
2. Draw a UML class diagram to illustrate the previous mentioned classes with 
necessary attributes and methods. Also, shown enough code fragments to 
illustrate your use of the pattern to solve the problem.