Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

lafore_robert_objectoriented_programming_in_c

.pdf
Скачиваний:
51
Добавлен:
27.03.2023
Размер:
8.94 Mб
Скачать

Object-Oriented Software Development

7. Classes may be related by (among others) g________, a_________, or a___________.

8.The waterfall process

a.consists of distinct phases.

b.was never actually used.

c.became untenable because of water shortages.

d.could go in only one direction.

9.True or false: If the UML is used, the Unified Process must also be used.

10.Classes in a program may correspond to

a.nouns in use case descriptions.

b.use cases.

c.associations in a UML diagram.

d.names of famous programmers.

11.True or false: Vague, general entities (such as “the system”) in a use case descriptions are not good candidates for classes in the program.

12.True or false: Entities with a single attribute and no methods are good candidates for classes.

13.In the Unified Process, which of the following may happen from time to time?

a.A use case diagram will be drawn up before the users have specified all the use cases.

b.A class diagram will be drawn before some use case descriptions are written.

c.Some code will be written before the class diagram is complete.

d.The header file with the class declarations will be changed while methods are still being coded.

14.Actors are ________ or ________ that interact with the ________.

15.For the LANDLORD program, STL container classes

a.cannot be used because they cannot be represented in use case diagrams.

b.make a good place to store expenses.

c.cannot be used because C++ is an object-oriented language.

d.make a good place to hide method bodies.

16.Class method definitions

a.should be placed in a header file.

b.should not be placed in a header file.

c.should probably not be distributed to customers.

d.should usually be distributed to customers.

845

16

O D BJECT EVELOPMENT S

OFTWARE - RIENTEDO

Chapter 16

846

17.True or false: Attribution is one of the major class relationships.

18.Assume there is an association between class A and class B. Also, objA is an object of class A, and objB is an object of class B. Which of the following applies?

a.objA may send a message to objB.

b.Class B must be a subclass of class A, or vice versa.

c.objB must be an attribute of class A, or vice versa.

d.objB may help objA carry out a task.

19.The LANDLORD program makes use of

a.generalization.

b.association.

c.insubordination.

d.aggregation.

20.True or false: In a class diagram, an association is shown as a relationship between objects.

21.In a sequence diagram

a.time goes from left to right.

b.associations go from right to left.

c.horizontal arrows represent messages.

d.vertical dotted lines represent lifetime.

22.A sequence diagram shows messages from one ________ to another.

23.True or false: A sequence diagram often describes a single use case.

24.In a sequence diagram, when a new class instance is created

a.a rectangle with its name is drawn at the appropriate vertical coordinate.

b.a large X marks the point in time.

c.its activity box begins.

d.its lifeline begins.

Projects

We don’t have room in this book for exercises involving the kind of projects involved in this chapter. However, we list some suggestions for projects you may want to pursue on your own.

1.Reread the explanation of the HORSE program from Chapter 10, “Pointers,” but do not look at the code. Create a use case diagram and a class diagram for this program. Use the results to create a .H file, and compare your results with the program. There are many correct results.

Object-Oriented Software Development

2.Reread the explanation of the ELEV program from Chapter 13, “Multifile Programs,” but do not look at the code. Create a use case diagram and a class diagram for this program. Use the results to create appropriate .H files. Compare your results with the program.

3.Create a use case diagram and a class diagram for a business situation you’re familiar with, whether it’s horse trading, software consulting, or dealing in rare comic books.

4.Create a use case diagram and a class diagram for a program you’ve always wanted to write, but haven’t had time for. If you can’t think of anything, try a simple wordprocessing program, a game, or a genealogical program that allows you to enter information about your ancestors and displays a family tree.

847

16

O D BJECT EVELOPMENT S

OFTWARE - RIENTEDO

ASCII Chart

A PPENDI X

A

850

Appendix A

 

TABLE A.1 IBM Character Codes

DEC

HEX

Symbol

Key

Use in C

0

00

(NULL)

Ctrl 2

 

1

01

A

Ctr A

 

2

02

B

Ctrl B

 

3

03

C

Ctrl C

 

4

04

D

Ctrl D

 

5

05

E

Ctrl E

 

6

06

F

Ctrl F

 

7

07

G

Ctrl G

Beep

8

08

H

Backspace

Backspace

9

09

I

Tab

Tab

10

0A

J

Ctrl J

Linefeed (new line)

11

0B

K

Ctrl K

Vertical Tab

12

0C

L

Ctrl L

Form Feed

13

0D

M

Enter

Carriage Return

14

0E

N

Ctrl N

 

15

0F

O

Ctrl O

 

16

10

P

Ctrl P

 

17

11

Q

Ctrl Q

 

18

12

R

Ctrl R

 

19

13

S

Ctrl S

 

20

14

T

Ctrl T

 

21

15

U

Ctrl U

 

22

16

_

Ctrl V

 

23

17

W

Ctrl W

 

24

18

X

Ctrl X

 

25

19

Y

Ctrl Y

 

26

1A

Z

Ctrl Z

 

27

1B

a

Esc

 

28

1C

b

Ctrl \

 

29

1D

c

Ctrl ]

 

30

1E

d

Ctrl 6

 

31

1F

e

Ctrl -

 

ASCII Chart

851

TABLE A.1 Continued

DEC

HEX

Symbol

Key

Use in C

32

20

 

spacebar

33

21

!

!

34

22

"

"

35

23

#

#

36

24

$

$

37

25

%

%

38

26

&

&

39

27

'

'

40

28

(

(

41

29

)

)

42

2A

*

*

43

2B

+

+

44

2C

,

,

45

2D

46

2E

.

.

47

2F

/

/

48

30

0

0

49

31

1

1

50

32

2

2

51

33

3

3

52

34

4

4

53

35

5

5

54

36

6

6

55

37

7

7

56

38

8

8

57

39

9

9

58

3A

:

:

59

3B

;

;

60

3C

<

<

61

3D

=

=

62

3E

>

>

63

3F

?

?

A

C ASCII

HART

852

Appendix A

 

TABLE A.1 Continued

DEC

HEX

Symbol

Key

Use in C

64

40

@

@

 

65

41

A

A

 

66

42

B

B

 

67

43

C

C

 

68

44

D

D

 

69

45

E

E

 

70

46

F

F

 

71

47

G

G

 

72

48

H

H

 

73

49

I

I

 

74

4A

J

J

 

75

4B

K

K

 

76

4C

L

L

 

77

4D

M

M

 

78

4E

N

N

 

79

4F

O

O

 

80

50

P

P

 

81

51

Q

Q

 

82

52

R

R

 

83

53

S

S

 

84

54

T

T

 

85

55

U

U

 

86

56

V

V

 

87

57

W

W

 

88

58

X

X

 

89

59

Y

Y

 

90

5A

Z

Z

 

91

5B

[

[

 

92

5C

\

\

 

93

5D

]

]

 

94

5E

^

^

 

95

5F

_

_

 

ASCII Chart

853

 

TABLE A.1 Continued

DEC

HEX

Symbol

Key

Use in C

96

60

'

'

 

 

97

61

a

a

 

 

98

62

b

b

 

 

99

63

c

c

 

 

100

64

d

d

 

 

101

65

e

e

 

A

102

66

f

f

 

 

 

103

67

g

g

 

 

104

68

h

h

 

 

105

69

i

i

 

 

106

6A

j

j

 

 

107

6B

k

k

 

 

108

6C

l

l

 

 

109

6D

m

m

 

 

110

6E

n

n

 

 

111

6F

o

o

 

 

112

70

p

p

 

 

113

71

q

q

 

 

114

72

r

r

 

 

115

73

s

s

 

 

116

74

t

t

 

 

117

75

u

u

 

 

118

76

v

v

 

 

119

77

w

w

 

 

120

78

x

x

 

 

121

79

y

y

 

 

122

7A

z

z

 

 

123

7B

{

{

 

 

124

7C

|

|

 

 

125

7D

}

}

 

 

126

7E

~

~

 

 

127

7F

f

Ctrl ←

 

 

ASCIIC HART

854

Appendix A

 

TABLE A.1 Continued

DEC

HEX

Symbol

Key

Use in C

128

80

Ä

Alt 128

 

129

81

ü

Alt 129

 

130

82

é

Alt 130

 

131

83

É

Alt 131

 

132

84

ä

Alt 132

 

133

85

à

Alt 133

 

134

86

å

Alt 134

 

135

87

ç

Alt 135

 

136

88

ê

Alt 136

 

137

89

ë

Alt 137

 

138

8A

è

Alt 138

 

139

8B

ï

Alt 139

 

140

8C

î

Alt 140

 

141

8D

ì

Alt 141

 

142

8E

Ä

Alt 142

 

143

8F

Å

Alt 143

 

144

90

É

Alt 144

 

145

91

æ

Alt 145

 

146

92

Æ

Alt 146

 

147

93

ô

Alt 147

 

148

94

ö

Alt 148

 

149

95

ò

Alt 149

 

150

96

û

Alt 150

 

151

97

ù

Alt 151

 

152

98

ÿ

Alt 152

 

153

99

Ö

Alt 153

 

154

9A

Ü

Alt 154

 

155

9B

õ

Alt 155

 

156

9C

£

Alt 156

 

157

9D

¥

Alt 157

 

158

9E

û

Alt 158

 

159

9F

ü

Alt 159