Question: Please do this Question In the coding language Smalltalk. Please do all of these questions. Thank you! 1) Next, create a new class category through
Please do this Question In the coding language Smalltalk. Please do all of these questions. Thank you!

1) Next, create a new class category through the System Browser called CPS506, and a new class called Lab1. Check the lecture slides for a reference on how to do this. Your Lab1 class will implement a rudimentary circular buffer. It must have the following methods and instance variables: A method called bufferInit: that accepts an array of literals as an argument. An instance variable called arr that is used to store the array object passed with the bufferInit: message. A method called getElem: that accepts an integer as an argument. This integer is to be used as a circular index. Out-of-bounds indexes should correctly wrap around. This includes negative values! Remember that Smalltalk is 1-indexed. An argument of 1 should correctly return the first element, and an argument of O should return the last element. All of this can be done with some clever arithmetic. You don't need any branching or control structures. 1) Next, create a new class category through the System Browser called CPS506, and a new class called Lab1. Check the lecture slides for a reference on how to do this. Your Lab1 class will implement a rudimentary circular buffer. It must have the following methods and instance variables: A method called bufferInit: that accepts an array of literals as an argument. An instance variable called arr that is used to store the array object passed with the bufferInit: message. A method called getElem: that accepts an integer as an argument. This integer is to be used as a circular index. Out-of-bounds indexes should correctly wrap around. This includes negative values! Remember that Smalltalk is 1-indexed. An argument of 1 should correctly return the first element, and an argument of O should return the last element. All of this can be done with some clever arithmetic. You don't need any branching or control structures
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
