某高校图书馆欲建设一个图书馆管理系统,目前已经完成了需求分析阶段的工作。功能需求均使用用例进行描述,其中用例“借书(CheckOutBooks)”的详细描述如下。
参与者:读者(Patron)。
典型事件流:
1.输入读者ID;
2.确认该读者能够借阅图书,并记录读者ID;
3.输入所要借阅的图书ID;
4.根据图书目录中的图书ID确认该书可以借阅,计算归还时间,生成借阅记录;
5.通知读者图书归还时间。
重复步骤3~5,直到读者结束借阅图书。
备选事件流:
2a.若读者不能借阅图书,说明读者违反了图书馆的借书制度(例如,没有支付借书费用等)
①告知读者不能借阅,并说明拒绝借阅的原因;
②本用例结束。
4a.读者要借阅的书无法外借
①告知读者本书无法借阅;
②回到步骤3。
说明:图书的归还时间与读者的身份有关。如果读者是教师,图书可以借阅一年;如果是学生,则只能借阅3个月。读者ID中包含读者身份信息。
现采用面向对象方法开发该系统,得到如图3-1所示的系统类模型(部分);以及如图3-2所示的系统操作“checkOut(bookID)(借书)”通信图(或协作图)。
【问题1】(8分)
根据说明中的描述,以及图3-1和图3-2,给出图3-1中C1-C4处所对应的类名(类名使用图3-1和图3-2中给出的英文词汇)。
【问题2】(4分)
根据说明中的描述,以及图3-1和图3-2,给出图3-2中M1-M4处所对应的方法名(方法名使用图3-1和图3-2中给出的英文词汇)。
【问题3】(3分)
用例“借书”的备选事件流4a中,根据借书制度来判定读者能否借阅图书。若图书馆的借书制度会不断地扩充,并需要根据图书馆的实际运行情况来调整具体使用哪些制度。为满足这一要求,在原有类设计的基础上,可以采用何种设计模式?简要说明原因。
正确答案及解析
正确答案
解析
【问题1】(8分)
C1:Patron
C2:Book
C3:Catalog
C4:CheckoutSessionController
【问题2】(4分)
M1:getForCheckOut
M2:isFaculty
M3:circulates
M4:recordBookLoan
【问题3】(3分)
应采用策略模式,策略模式定义了一系列算法,并将每个算法封装起来,而且使它们可以相互替换。策略模式让算法独立于使用它们的客户而变化。适用于需要在不同情况下使用不同的策略(算法),或者策略还可能在未来用其他方式来实现。
根据系统类模型,我们可以各个类之间的关联关系。
首先从类Accounts中的can CheckOut(patronID:string)方法,可以看出Accounts关联Patron,因此图中C1为Patron。
C1为Patron,则C1必会与书关联,从C1中的recordBookLoad(b:C2),可以看出C1关联C2。因此C2为Book。
C2为Book,根据系统操作check Out的通信图,可以看出与Book关联的是Catalog,因此C3为Catalog。
结合两图,则可以得出C4为CheckoutSessioncontroller。
结合典型事件流:
1.输入读者ID;
2.确认该读者能够借阅图书,并记录读者ID;
以上两步实际上就是判断读者是不是老师,也就是isFaculty(),因此M2为isFaculty()。
3.输入所要借阅的图书ID;对应的操作就是M1:getforcheck(book ID)。
4.根据图书目录中的图书ID确认该书可以借阅,计算归还时间,生成借阅记录;对应的操作就是M3:circulates()。
5.通知读者图书归还时间。对应的操作就是M4:recordBookLoan()。
包含此试题的试卷
你可能感兴趣的试题
Advancements in ( )have contributed to the growth of the automotive industry through the creation and evolution of self-driving vehicles.
-
- A.Artificial Intelligence
- B.Cloud Computing
- C.Internet of Things
- D.Big Data
- 查看答案
In project human resource management , ( )is not a source of power for the project manager.
-
- A.referent power
- B.expert power
- C.reward power
- D.audit power
- 查看答案
At the project establishment stage , the feasibility study mainly includes techinical feasibility analysis , ( ), operation environment feasibility analysis and other aspects of feasibility analysis.
-
- A.detail feasibility analysis
- B.opportunity analysis
- C.economic feasibility analysis
- D.risk analysis
- 查看答案
( )is a grid that shows the project resources assigned to each work package.
-
- A.Stakeholder engagement assessment matrix
- B.Requirements traceability matrix
- C.Probability and impact matrix
- D.Responsibility assignment matrix
- 查看答案
Xinhua News Agency reported in January 2022,Chian will further promote the developmet of a digital economy during the 14th Five-Year Plan eriod(2021-2025). The plan also emphasized industrial ( )transformation.
-
- A.digital
- B.networking
- C.intelligentize
- D.informatization
- 查看答案