大连理工大学887软件工程类图设计题答案

VIP免费
3.0 北木在北 2025-12-27 999+ 369.02KB 3 页 1知币 海报
侵权投诉
下面给出的代码是使用 JAVA 语言对四个类的实现。为了简短起见,一些
定义的细节没有给出,另外还省略了相应的 setter getter 方法。对这些代码进
行反工程,要求使用 UML 给出它们的设计类图。
class TestQuestion {
public static void main(String [] args)
{
CardList myCardList = new CardList();
Card newCard;
for (inti = 1; i<= 2; i++){
int j = i + 5;
newCard = new Card(i, j);
myCardList.insertCard(newCard);
}
}
}
class Card {
public Card(int s, int r) { suit = s; rank = r; }
protectedint suit;
protectedint rank;
...
}
classListElement {
protected ListElement prev;
protected ListElement next;
protected Card card;
...
}
class CardList {
// This method creates a new list element on the heap associated with
// the input card and inserts into the beginning of this list.
public void insertCard(Card card) { ... }
// This method removes the input card from this list.
public Card removeCard(Card card) { ... }
// This method returns the first card of this list.
public Card getFirst() { ... }
...
Protected int noOfElements;
protectedListElement first;
protectedListElement last;
}
大连理工大学887软件工程类图设计题答案.pdf

共3页,预览1页

还剩页未读, 继续阅读

作者:北木在北 分类:考研考博类 价格:1知币 属性:3 页 大小:369.02KB 格式:PDF 时间:2025-12-27

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 3
客服
关注