Object subclass: #Shape instanceVariableNames: 'id color' classVariableNames: '' poolDictionaries: '' category: 'CS323' getColor ^color. setColor: value color := value. getId ^id. setId: value id := value. Shape subclass: #CS323Rectangle instanceVariableNames: 'length width' classVariableNames: '' poolDictionaries: '' category: 'CS323' CLASS METHODS id: id color: color length: length width: width | temp | temp := CS323Rectangle new. temp setId: id. temp setColor: color. temp setLength: length. temp setWidth: width. ^temp. INSTANCE METHODS getLength ^length setLength: value length := value. getWidth ^width. setWidth: value width := value. getArea ^(length * width). getPerimeter ^(length + width)*2. CS323Rectangle subclass: #CS323Square instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'CS323' CLASS METHODS id: id color: color side: side | temp | temp := CS323Square new. temp setId: id. temp setColor: color. temp setSide: side. ^temp. INSTANCE METHODS getSide ^length setSide: value length := value. width := value. Shape subclass: #CS323Circle instanceVariableNames: 'radius' classVariableNames: '' poolDictionaries: '' category: 'CS323' CLASS METHODS: getPI ^3.1415926 id: id color: color radius: radius | temp | temp := CS323Circle new. temp setId: id. temp setColor: color. temp setRadius: radius. ^temp. INSTANCE METHODS getRadius ^radius. setRadius: value radius := value. getArea ^(self class getPI) * radius * radius. getCircumference ^(self class getPI) * radius * 2. WORKSPACE STUFF | x y z | x := CS323Rectangle id: 42 color: 'blue' length: 10 width: 20. y := CS323Square id: 42 color: 'red' side: 10. z := CS323Circle id: 42 color: 'white' radius: 10. "Demonstrating Inheritance" Transcript show: x printString; show: ' '; show: (x getColor). Transcript cr. Transcript show: y printString; show: ' '; show: (y getColor). Transcript cr. Transcript show: z printString; show: ' '; show: (z getColor). Transcript cr. "Demonstrating Polymorphism" list := OrderedCollection with: x with: y with: z. list do: [:a | Transcript show: a printString; show: ' '; show: a getArea; cr].