Question: Lab Description 1) Write a Smalltalk script in the playground that computes and prints the average of all the even integers in an array. You


Lab Description 1) Write a Smalltalk script in the playground that computes and prints the average of all the even integers in an array. You may use any loop style you like. Assume nothing about the contents of the array; It might contain any mixture of types or objects. However, only those elements that are integers, and even, should contribute to the average. Create your own heterogeneous array to test your script. 2) Write a Smalltalk script in the playground that instantiates an empty OrderedCollection object, generates 20 random integers between 0 and 15 (inclusive), and adds those integers to the OrderedCollection. You should then print the contents of the OrderedCollection, as well as the number of unique elements in the OrderedCollection. Hint: Smalltalk has a class called Random which implements the function next. It returns a number in the range [l 0 1]. 3) Write a Smalltalk script in the playground that finds and prints the largest, odd number in an array of integers. You may use any loop style you want, but in your loop, you should use a BlockClosure to test if the number is odd. Create your own array of integers to test your script
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
