1.
Use a timesRepeat: loop to sum the odd integers from 1 to 20.
2a.
Add a method to the Array class to return the average of all elements of the
array. Assume all elements in the array are of the same type and are subclasses
of Magnitude (that is understand <, >, <= ,>=, =).
3b.
Write a Sunit test(s) for your method in part a.
4.
Use select: to create a collection containing all the characters in a string
that have an ascii value higher than the ascii value of m.
5.
Use collect: to convert a string of alphabetic characters to all uppercase.
6.
Use inject:into: to find the character with the largest ascii value in a string.
7.
Words. Add a method called words to the String class. This method returns a
collection of the words in a string. For this problem words are separated by
one or more of the following characters: space, tab, carriage return, period
(.), comma (,) , semicolon (;), question mark (?), single quite (‘),
double quote (“) or the exclamation point (!). Provide Sunit test(s) for
the method. (Hint see the method tokensBasedOn: or runsFailing:do:)
8.
For this problem the value of an alphabetic character is its location in the
alphabet. So ‘a’ and ‘A’ each have value 1,
‘b’ and ‘B’ each have 2, etc. Non-alphabetic characters
can be considered to have value 0. The value of a word is the sum of the value
of all its characters. So ‘Smalltalk’ has value 101 and
‘cat’ has value 24. A dollar word is a word whose value is 100.
Add a method to the String class that returns all the dollar words in the
string. Provide unit test(s) for the method. (Hint problem 7 may be useful).
   
visitors since 09-Sep-03