Question: Use Java language to implement Simple List Class SimpleList list : int[] count: int - + Simple List () + add (int): void + remove
Use Java language to implement![Use Java language to implement Simple List Class SimpleList list : int[]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f13d746ed33_93966f13d73d26f4.jpg)
Simple List Class SimpleList list : int[] count: int - + Simple List () + add (int): void + remove (int): void + count (): int + toString (): String + search (): int Notice there is no main, no input and no output for this assignment. Method Descriptions SimpleList() - Create an array to hold 10 integers and set count to 0. add (int): void - Add the parameter to the list at the beginning (index=0). Move all the other integers in the list over so there is room. If the list was full, then the last element "falls off the list. Increment the count as needed. remove (int): void - If the parameter is in the list, then remove it. The other values in the list may need to be moved down. Adjust the count as needed. count (): int - Return the number of elements stored in the list. toString(): String - Return the list as a String. The elements must be separated by a space. This means there is not space after the last integer. search (int): int - Return the location of the parameter in the list. If the parameter is not in the list, then return -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
