Using smalltalk In all problems, assume input will be acceptable. For example, f
ID: 3633817 • 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
c. return a list consisting of two lists that have been split at a given element;
aC split: element
The given element should be the head of the second list.
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]] ] ]
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.