JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Software Design » Design Pattern  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
作者 大家好,可唔可以教我點做呢個?

發文: 3
積分: 0
於 2014-11-22 11:50 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

GoodHealth Fitness Corporation is a large fitness club. It provides state-of-the-art equipment to its members to use. The company maintains a membership system for recording members’ information and prepaid hours for using the club’s facilities. Recently, GoodHealth plans to acquire GreenFitness Limited which is a small fitness club. After the acquisition, GrantFitness Corporation is established to manage the business operation of GoodHealth Fitness Corporation and GreenFitness Limited.

GoodHealth uses a class called “MemberCare” to manage the member records. The system has the following basic methods to support the daily operations.
1. createMember ( ) to create a Member object with zero prepaid hours
2. searchMember ( ) to search a Member object by id
3. remove ( ) to remove a Member object by id
4. changePhoneNumber ( ) to update the phone number of a Member object
5. addPrepaidHours ( ) to add the given hours to a Member object
6. usePrepaidHours ( ) to deduct the given hours from a Member object

GreenFitness uses a class called “ClientControl” to manage the client records. The system has the following basic methods to support the daily operations. 1. createClient ( ) to create a Client object with zero remaining hours

findClient ( ) to search a Client object by cid

deleteClient ( ) to remove a Client object by cid

updateContactNumber() to update the contact phone number of a Client object

addHours ( ) to add the given hours to a Client object

deductHours () to deduct the given hours from a Client object

The followings are the simplified class diagrams of the existing systems for your reference.

As a system analyst of the GrantFitness Corporation, you are required to support the system integration. You are asked to design and develop the GrantFitness System for integrating the classes in the existing two systems. You are reminded that the design of the existing classes: MemberCare, Member, ClientControl, and Client must be kept unchanged.

You should minimize the impact of future change on data structures and operations in both existing systems. However, your new system should integrate the operations with one common user interface. Moreover, GrantFitness may acquire other company in the future and your new system must support future integration.

The new system should provide the following functions:
1. Create a new member record for a new member in a company (GoodHealth, or GreenFitness, or any new company in the coming future)
2. Show member details (such as id/cid, name/cname, phoneNumber/contactNumber, prepaidHours/remainingHours) by a given id (input id=* to show all records)
3. Add/deduct hours to/from a member record
4. Update the phone number of a member record
5. Undo last command
6. Redo the last undone command
7. Show undo/redo list

Your system design should conform to the Open Closed Principle so that your design should easily support new functions, e.g. change the name of a member.

You MUST apply the following design patterns for your new system:  Adapter pattern to support the operations between the two existing companies and the future integration for any new company acquired by GrantFitness Corporation.

**** Memento pattern to support “Undo” and “Redo” functions****

Extra Reference This sample run is served for reference only. You are free to design your own user interface.

how to do the adapter and Memento pattern


ccccccc1314 edited on 2014-11-22 17:22
reply to postreply to post
人氣 標題 作者 字數 發文時間
876 大家好,可唔可以教我點做呢個? ccccccc1314 3507 2014-11-22 11:50
696 Re:大家好,可唔可以教霉我點做呢個? roysiu 450 2014-11-22 16:45
681 Re:大家好,可唔可以教我點做呢個? ccccccc1314 55 2014-11-22 20:35
670 Re:大家好,可唔可以教我點做呢個? roysiu 181 2014-11-22 21:35
673 Re:大家好,可唔可以教我點做呢個? ccccccc1314 13 2014-11-22 21:37
697 Re:大家好,可唔可以教我點做呢個? roysiu 110 2014-11-22 22:00
586 Re:大家好,可唔可以教我點做呢個? roytsang 123 2014-11-24 14:58
712 Re:大家好,可唔可以教我點做呢個? roysiu 209 2014-11-25 05:54
» JWorld@TW »  Software Design » Design Pattern

reply to postflat modego to previous topicgo to next topic
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8