ENVY/QA User Guide : Code Metrics : Guided Tour : Creating a Class to Measure
Creating a Class to Measure
Create 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
Person public instance methods
age
^age
 
happyBirthday
"The receiver has had a birthday.
Display a Happy Birthday message, and increment his/her age."
age := age + 1.
System message: ('Happy ', self age printString, ' Birthday, ', self name, '!').
 
name
"Answer the name (String) of the receiver."
^name
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: 01/29/2015