The content on this page is the work of Professor Glenn Blank.
Be advised that Professor Blank is no longer on the active faculty at Lehigh.
This content continues to be available as a courtesy, but it may not be maintained or current.

“Still Life with Fruit”

CSE432: Object‑Oriented Software Engineering


An artist wants some software to represent objects he might manipulate in still life paintings.  For our prototype, we want to design a system of classes that manipulate different kinds of fruit in a bowl.  Fruit generally have the following attributes of interest: they have a color, a size, and a center located in two‑dimensional space. To keep the prototype simple, colors will simply be strings, and  the only geometric attribute we will consider is size.  The artist wants to be able to manipulate these attributes: changing colors, growing (or shrinking) size, moving centers.  However, different kinds of fruit have different default colors and sizes. Apples are (by default) red and 2" in diameter, bananas are yellow and 6" in length, grapes are purple and come in clusters of seven grapes.  When an apple changes size, its diameter grows (or shrinks) by some specified amount (positive or negative), but bananas grow longer or shorter, and grapes add or remove some whole number of grapes to the cluster. Finally, a bowl is a collection of fruit, to which the artist may add or remove individual fruit (apples, bananas and grapes), access individual fruit (in order to change their attributes), and print out the collection with their current attributes. For the prototype, we will defer all user interface concerns; you may assume that all operations will be demonstrated by a main driver function. 


Hand in:

1)      Analysis for Fruit problem, modeling the fruit “system” as a class diagram in UML notation.

            Hint: try to exploit inheritance, dynamic binding and abstraction.
2)  A class diagram for the “undo” problem (

Hint: verbs can be classes, too! (Especially if they are processes or activities that need to store state information.)

You may create your UML diagrams with any tool or integrated development environment (IDE):

Due: Sunday, 2/19.  Please upload your work to the Blackboard site, assignments area.


You will continue to work on the fruit problem, submitting a design (reworking the class diagrams, adding user interface design, and adding ADT specifications), and then implement it in Java, later this semester (see the syllabus).


The domain analysis for your term projects should be submitted by Monday 2/27.

Include UML class and interaction (either sequence or collaboration) diagrams.

But first revise your requirements specs per my comments and make these available to me also, preferably via a web site for your project.