9A

For this problem, you are going to repeat homework 8C, but with array lists of Strings rather than arrays of ints.

Complete the ArraysListMethods class. All the methods have been implemented as stubs so the class compiles

  1. Swap the first and last elements in the array list.
  2. Shift all elements by one to the right and move the last element into the first position.You can use the method add(0, value) to inssert at the beginning of the arraylist. For example, "dog", "cat", "pig"," horse" would be transformed into "horse", "dog", "cat", "pig"
  3. Remove the middle element if the array list length is odd, or the middle two elements if the length is even. Physically rmove the elements so the array list has fewer elements.
  4. Return the second-largest element in the array list. You can use the compareTo method. ("Zed" is larger than "Alpha")
  5. Return true if the arraylist is currently sorted in increasing order.

For the draft, implement a and b

9A draft: http://cs12.cs.sjsu.edu:8080/netbrat/files?repo=ext&problem=1303261532512902864214811411
9A final: http://cs12.cs.sjsu.edu:8080/netbrat/files?repo=ext&problem=1303261532512902864214811411&level=2

9B

Complete the letterA method in the Homework9BTester class. The letterA method will take an array list as a parameter and return a new arraylist that contains all the words that start with "A" or "a" The method does not change the original list.

Do not use the String's startsWith method

For the draft, create a new array list of Strings and add the first element of the original array list to it.

9B draft: http://cs12.cs.sjsu.edu:8080/netbrat/files?repo=ext&problem=13032615384442240929721343467
9B final: http://cs12.cs.sjsu.edu:8080/netbrat/files?repo=ext&problem=13032615384442240929721343467&level=2

9C

Complete methods in the RectangleList class.

RectangleList constructor takes an arraylist of Rectagles

largestArea returns the rectangle with the largest area.

targetCount returns how many rectangles have an area less than the given target.

areaAverage returns the average areas of the rectangles.

For the draft, finish the constructor and supply the appropriate instance variable

9C draft: http://cs12.cs.sjsu.edu:8080/netbrat/files?repo=ext&problem=13032615474255560151124736518
9C final http://cs12.cs.sjsu.edu:8080/netbrat/files?repo=ext&problem=13032615474255560151124736518&level=2