Review Solution

advertisement
MCS 270 Object-Oriented design Exam Review – Solutions
7.2.a. Three Possible answers:
User. A person who uses system
Server. A computer that communicates with the email system and is the
intermediate source and destination of email messages.
Admin. A person who administers system
7.2.b. Get email. Retrieve email from the server and display it for the user
Manage email. Perform tasks such as deleting email, managing folders,
and moving email between folders.
Set options. Set preferences to the user’s liking.
Maintain address list. Keep a list of email addresses that are important to
the user.
7.2.c.
7.2.d. Get email.
User logs in to email system.
System displays the mail in the
Inbox folder.
User requests that system get new email.
System requests new
email from server.
Server returns new email to system.
System displays the
mail in the Inbox folder and highlights unread messages.
Send email.
User composes an email message and requests that system sends it.
Local computer sends email to server.
Server acknowledges receipt of email to
send.
Manage email.
User logs in to email system.
User clicks on Sent folder.
User deletes all email in Sent folder.
Set options.
User logs in to email system.
User requests change of
password.
Local computer displays password change form. User enters new
password.
User reenters new password. Local computer sends new password
to server. Server accepts new password.
Maintain address list.
User clicks on Inbox folder. User selects a message.
User adds sender to address list.
7.3.a. User. The person who is seeking service from the airline.
Airline. A company that offers scheduled flights available for purchase.
7.3.b. Make reservation. Book and pay for an airline flight and possibly choose a
seat.
Check availability. Given data (such as origin, destination, date, airline
preference), find the available flights and prices.
Check flight status. Report the status of a flight that is underway (on-time,
delayed, missing information, ...).
Handle benefits. Display the current frequent traveler status for a person, register
a new frequent traveler, book frequent traveler flights, show available flights, ...
Send an inquiry. Let a user submit email to report flight dissatisfaction, frequent
traveler benefit problem, or communicate some miscellaneous message to an
airline.
7.3.c.
12.3 The following classes should be eliminated.
Redundant classes. SelectedObject, SelectedLine, SelectedBox, SelectedText (re
dundant with Selection), Connection (redundant with Link).
Irrelevant classes. Computer (it is implicit that we are developing a model for the
purpose of computer implementation).
Vague classes. GraphicsObject (not sure precisely what this is; we do not need it
as we have more specific classes).
Attributes.position, length, width, fileName, lineSegmentCoordinate, name,
origin, scaleFactor, x-coordinate, y-coordinate.
Implementation constructs. Menu (but you could argue about whether Menu
should be a class), Mouse, Button, Popup, MenuItem (a matter of implementing
menus), CornerPoint, EndPoint (there are other ways to specify a Box), Character
(an implementation construct for Text). After eliminating improper classes we are left with Line, Link, Collection,
Selection, Drawing, DrawingFile, Sheet, Point, Box, Buffer, and Text.
12.4 We only need to prepare a data dictionary for proper classes.
Line—a graphical entity that connects two points; actually a line
segment. Lines may be horizontal or vertical.
Link—a connection path between two boxes. A link is represented as a
series of joined alternating vertical and horizontal lines.
Collection—a set of two or more lines and boxes, not necessarily
connected. A col- lection is a grouping defined by the user and
manipulated as a unit for moves and de- letes, for example.
Selection—a set of boxes and links that the user selects with a mouse.
Drawing—a set of sheets that contain boxes and links.
DrawingFile—a file that contains a stored representation of a drawing.
Sheet—a set of boxes and links that fit on a standard piece of printer
paper. Each box and link is on exactly one sheet.
Point—a location on a sheet.
Box—a rectangle optionally containing a single string of text.
Buffer—a temporary holder for copied and cut selections. The paste
operation uses the buffer contents.
Text—a sequence of characters on a single horizontal line located within
a box.
12.5 The following tentative associations should be eliminated because they are
between eliminated classes:
A box has a position. (Position is an attribute that has been eliminated.
Replace by a box has a point.)
A character string has a location. (Location is an attribute. We are using
the term text and not character string.)
A line has length. (Length is an attribute that has been eliminated.)
A line is a graphical object. (For this problem, we do not consider
GraphicalObject as a class worth modeling.)
A point is a graphical object. (For this problem, we do not consider
GraphicalObject as a class worth modeling.)
A point has an x-coordinate. (X-coordinate is an attribute that has been
eliminated.)
A point has a y-coordinate. (Y-coordinate is an attribute that has been
eliminated.) The following tentative associations are irrelevant or implementation artifacts:
A character string has characters. (This is not important enough to include
in the model.)
A box has a character string. (This is the same as a box has text.)
The following tentative associations are actions:
A box is moved.
A link is deleted.
A line is moved.
The following associations are derived:
A link has points.
A link is defined by a sequence of points. (Replace by a link corresponds to
one or more lines.) The following associations were missing from the list given in the exercise:
A drawing has one or more sheets.
A drawing is stored in a drawing file. We are left with the following correct associations and generalizations: a box has
a point, a box has text, a link logically associates two boxes, a link corresponds to
one or more lines, a selection or a buffer or a sheet is a collection, a collection is
composed of links and boxes, a line has two points, a drawing has one or more
sheets, and a drawing is stored in a drawing file.
13.7 The application is a simple editor that supports only boxes, links, and text.
Text is allowed only in boxes and the text size and font is fixed. Boxes
automatically adjust to fit the enclosed text. Links consist solely of horizontal and
vertical lines.
13.8 Actors are the user and the file system.
13.9 Use cases represent a kind of service that the system provides and should be
at the same level of detail. Consequently the use cases should not reflect detailed
operations, but instead should focus on high level tasks that the user can perform.
Create drawing. Start a new, empty drawing in memory and overwrite any prior
contents. Have the user confirm, if there is a prior drawing that has not been saved.
Modify drawing. Change the contents of the drawing that is loaded into memory.
Save to file. Save the drawing in memory to a file.
Load from file. Read a file and load a drawing into memory overwriting any prior
contents. Have the user confirm, if there is a prior drawing that has not been saved.
Quit drawing. Abort the changes to a drawing and clear the contents of memory.
Download