Typically, a midterm in 2390 is 4-5 questions like each of the below. Most of the questions below are from actual midterms in 2390. I recommend working together through the CaMILE links to figure out the solutions. I will check up on the discussions, but I won't provide answers where no answers are posted.
. Macrosoft Corporation is creating
a new suite of applications software, designed using an object-oriented
approach with Smalltalk as the target language. You have been
asked to do the initial analysis of the document needs for printing
and saving documents.
Your first thoughts on the analysis look something like this:
I am a Document. I know how to save myself (to a filename), and I remember my base filename and directory path. I know how to open and close myself. I also know how to print myself, and I remember my printing parameters (such as landscape or portrait printing mode).
I am a Word-Processing Document. I know
what fonts I need, what my margins are, and what my header and
footer is (if any). I know how to paginate myself.
The below figure is a snapshot of what you're
thinking about for the graphical notation, but it isn't yet complete
(e.g., no decisions yet on what's concrete and what's abstract).

A. You now need to extend your analysis to
include Drawing Documents. Drawing Documents have text
boxes that can use multiple fonts, and they have margins, but
they don't usually have headers and footers. Drawing Documents
also have to keep track of picture elements that they consist
of: lines, rectangles, pasted-in bitmaps, etc. They do need to
be able to paginate themselves. Show me (a) how you would describe
the Drawing Document class in terms of the Coad & Nicola "I
am a" notation and (b) how you would extend the graphical
representation pictured above to include Drawing Documents. (Go ahead
and use the back of this page.)(Just turn the monitor over...:-) Please describe in words how you would make these changes Post your answers, comments, questions, concerns, etc. here
Post your answers, comments, questions, concerns, etc. here
In the below short answers, I expect to see
the following terms used:
Class
Subclass
Concrete and Abstract class
Inheritance
Gen-spec relationship
Whole-part relationship
Describe the relationship between:
The Dinosaur and DinoParts
classes.
The Plateosaur and Raptor classes.
The Dinosaur and Raptor classes.
The size instance variable in the
Dinosaur
class, in the Plateosaur
class, and in the Legs
class.
Post your answers, comments, questions, concerns, etc. here
This code might be used like this:
Post your answers, comments, questions, concerns, etc. here
Post your answers, comments, questions, concerns, etc. here
Post your answers, comments, questions, concerns, etc. here
Post your answers, comments, questions, concerns, etc. here
Post your answers, comments, questions, concerns, etc. here
Post your answers, comments, questions, concerns, etc. here
attack: target
| location |
location := target position.
self aim: position.
self useWeapon.
| aRaptor aPtero |
aRaptor := Raptor new.
aPtero := Pterodactyl new.
aRaptor attack: aPtero.
Classes
CashDevice
CashDeviceViewContainer
DisplayBox
DisplayBoxController
DispensingHolder
Item
ItemViewContainer
ModelValueViewContainer
dispense: itemToDispense
self isEmpty ifTrue: [^false].
(self itemIsDispensable: itemToDispense) ifFalse:
[^false].
self printItem: itemToDispense .
self activateDispenser.
self disconnectWithItem: itemToDispense.
^true