showTimesSevenin class Integer that generates a number seven times as large as the receiver, converts that number to a string, and then displays that number on Transcript. For example, executing "
11 showTimesSeven" should result in 77 being shown on Transcript. Remember that
selfis the receiver of a message,
asStringconverts things into strings, and
show:is a message Transcript understands for displaying strings.
Integerthat returns the larger of the number squared and 100 times the number. For example, "1 largerFunction" should return 100, and "500 largerFunction" should return 250000.
Integerthat returns the smallest factor of the receiver that is greater than 1. It should try numbers from 2 up to the the number itself, and it should return the first tried number which divides the receiver evenly. You can test whether a number divides evenly by using \\, the remainder function, and seeing if the result is 0. "9 smallestFactor" should be 3, "11 smallestFactor" should be 11, and "221 smallestFactor" should be 13.
trueif a number is chunky and
falseotherwise. Then, write a class method
Integerthat prints the chunky numbers between 2 and 100 onto Transcript. You might want to use the
smallestFactormethod you wrote for last week.
Integerwhich returns a collection containing the first 100 chunky numbers which are greater than 0. You may use any kind of collection you wish.
Counterwith one instance variable name
count. Add the following methods to it:
count– returns the current value of
countString– returns the current count, but printed to a string.
increaseCount– increase the count by one.
openUI– open a PluggableTextMorph that reflects the value of the receiver's
count, and a PluggableButtonMorph that, when pressed, will cause
increaseCountto be called on the receiver.
secondSmallestin class Collection which returns the second smallest element of the collection. Use #< to decide whether one element is smaller than another. Examples:
#(1 2 3 4) secondSmallest" —> 2
#(4 3 2 1) secondSmallest" —> 2
#('one' 'two' 'three' 'four') secondSmallest" —> 'one'
concatenatedStrings, which sends #asString to all elements of a collection and then concatenates the results together into a long string that is returned. Transcript should not be involved. For example:
#(1 2 3) concatenatedStrings"print-it" —> '123'
#(abc 'def' 27.00) concatenatedStrings"print-it" —> 'abcdef27.0'
#(1 2 3) asSet concatenatedStrings"print-it" —> '123'
updateResultso that when a new request is submitted in the top pane, the proper result is computed and displayed in the bottom pane.
updateRequestis already called whenever the request changes, but currently it does nothing.