Question: hi, i am taking a java class and i was given this program can anyone please help? Design, specify and implement a collection class that
hi, i am taking a java class and i was given this program can anyone please help?
Design, specify and implement a collection class that is similar to an array of double numbers except that it automatically grows when needed and negative indexes are also permitted. Hint: One way to allow for both positive and negative indexes is to have two arrays, one for elements with positive indexes and another for negative indexes. The class should include a method to put a double number into the "array" at a specified index. For example, suppose that v is an object of this class. Then v.put(3.8, 7) would put the number 3.8 at the index 7 of the "array". Since negative indexes are also allowed, the statement v.put(9.1, -3) would put the number 9.1 at the index -3. The class also includes a method to revive the number from a specified index. For example, v.get(7) would return the value of the number that is currently at index 7 of the "array". If a programmer tries to get a value that has not yet been put into the array, then the get method will return he Java constant Double.NaN (which is the way Java represents a double value that is not a real number). In addition to implementation, find the boundary values and test the methods of this class with these values.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
