某公司欲开发一个管理选民信息的软件系统。系统的基本需求描述如下:
(1)每个人(Person)可以是一个合法选民(Eligible)或者无效的选民(Ineligible)。
(2)每个合法选民必须通过该系统对其投票所在区域(即选区,Riding)进行注册(Registration)。每个合法选民仅能注册一个选区。
(3)选民所属选区由其居住地址(Address)决定。假设每个人只有一个地址,地址可以是镇(Town)或者城市(City)。
(4)某些选区可能包含多个镇;而某些较大的城市也可能包含多个选区。
现采用面向对象方法对该系统进行分析与设计,得到如图1-1所示的初始类图。
【问题1】(8分)
根据说明中的描述,给出图1-1中C1~C4所对应的类名(类名使用说明中给出的英文词汇)。
【问题2】(3分)
根据说明中的描述,给出图1-1中M1~M6处的多重度。
【问题3】(4分)
现对该系统提出了以下新需求:
(1)某些人拥有在多个选区投票的权利,因此需要注册多个选区;
(2)对于满足(1)的选民,需要划定其“主要居住地”,以确定他们应该在哪个选区进行投票。
为了满足上述需求,需要对图1-1所示的类图进行哪些修改?请用100字以内文字说明。
正确答案及解析
正确答案
解析
【问题1】
C1:Address?C2:Riding?C3:Ineligible?C4:Eligible
【问题2】
M1:1,M2:*,M3:*,M4:1,M5:*,M6:1。
【问题3】
(1)将M1修改为1..*,在Registration类中增加address属性,指明注册时使用的是哪个地址。
(2)增加一个类“主要居住地”,作为类Address的子类;类Person与类"主要居住地"之间具有关系联系,且每个人只有一个主要居住地。
本题考查在面向对象分析与设计过程中,如何利用类图描述系统需求模型及设计模型。考试需要理解面向对象方法的相关概念和思想,并熟悉UML的语法及应用。类图及用例图是考试题中最多出现的两种UML模型。
(1)由需求1可知,Person下面只有Ineligible和Eligible,C3为孤立点,C4还与其他类有关系,故C3为Ineligible,C4为Eligible。Person与C1的关系是lives at,故C1应为Address,C2为Riding。
(2)Address与Person应为1对多,故M1为1,M2为*。Eligible与Riding的关系应为多对1,则M3应为*,M4应为1。一个选区包含多个镇,每个镇多个地址,故Address与Riding的关系为多对1。
包含此试题的试卷
你可能感兴趣的试题
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
- 查看答案