Creating an Application
Create the application SampleApplication and add the following class and methods.
Person class
Object subclass: #Person
instanceVariableNames: 'name age '
classVariableNames: ''
poolDictionaries: ''
Person public class methods
named: aString age: anInteger
"Answer a new instance of the receiver whose name is aString
and age is anInteger."
^self new
name: aString;
age: anInteger
initialize
"Initialize the receiver. This should only be done when it is first loaded
into the image."
Transcript cr; show: 'Initializing the receiver.'
Person public instance methods
happyBirthday
"The receiver has had a birthday.
Display a Happy Birthday message."
System message: ('Happy ', self age printString, ' Birthday, ', self name, '!').
name
"Answer the name (String) of the receiver."
^name
age
“Answer the age (Integer) of the receiver.”
^age
Person private instance methods
age: anInteger
"Set the age (Integer) of the receiver to anInteger."
age := anInteger
name: aString
"Set the name (String) of the receiver to aString."
name := aString
Last modified date: 06/30/2015