Using Smalltalk In all problems, assume input will be acceptable. For example, f
ID: 3633816 • Letter: U
Question
Using Smalltalk In all problems, assume input will be acceptable. For example, finding the next to last element in a list will not be tested with a one element, or empty list.The class OrderedCollection is a collection class with a fixed order but indefinite size. Use the browser to familiarize yourself with the methods of this class.
Then subclass this class, naming it YourNameCollection and add the following method to your class
b. Find the element after a given element; call aC findAfter: element
Explanation / Answer
Dear, Here is the code YourNameCollection extend [ init [ count=0. numbers := OrderedCollection new. numbers add: 1; add: 2; add: 3; add: 4; add: 5; add: 6; add: 7; numbers do: [ :each | each element modulo of element/2 is 0 ifTrue: [ count=count+1]] ] ]