CSC 17: Final Project Warmup. Due Thursday 5/1 For this lab we will practice some basic programming skills in preparation for the final programming project. 1. Using the ArrayList<..> data structure. To use this structure, you need to first import java.util.ArrayList; at the top your program. Consult the Java API documentation on what can be called on ArrayList objects. The following is a function that returns an ArrayList of n randomly generated Doubles: ArrayList genlist(int n) { ArrayList A = new ArrayList(); // empty arraylist for(;n>0;n--) A.add(Math.random()); return A; } Now write a function that returns the smallest double from an Arraylist of doubles, i.e, a function takes an ArrayList parameter and returns a double (casting from Double to double is automatic). Write code to use the .set, .get, .remove, and .size methods of ArrayList, just so you'll know how to use them. Put everything inside a public class, with main, and run it. 2b. Complete the following data strucuture, which represents a bank account: class account implements Comparable { private double balance; account(double b) {balance =b; } // constructor sets initial balance void transaction(double amt) { balance += amt; } // WRITE A FUNCTION THAT SATISFIES THE Comparable interface // Look at class notes, or the API documentation, to find out what // this entails. Bank accounts should be compared based on their // balances. } Write a function that takes an ArrayList of account objects and returns a pointer to the account with the smallest balance; Note that if you reverse the definition of the compareTo function, you can get the same function to return a pointer to the account with the largest balance. 3. To prepare for the Astar assignment, download all relevant files into a separate directory (you can compile everything with javac *.java). The basic assignment asks you to write the 'search' function inside the astar class. The one you downloaded simply return null, which means no path to target. (run the pathfinder program: java pathfinder). The following version of search is a bit more interesting: it creates a path from source to destination by following the most direct route, regardless of terrain cost (regardless of going over land or water). That is, it never consults the M terrain matrix. // create path from from source to target, return end of path coord. public coord search(int sy, int sx, int ty, int tx) { int x, y; // coordinates of "current" node: y=sy; x = sx; coord previous = null; coord current = new coord(y,x); while (!(x==tx && y==ty)) // while not at target coord { if (tx>x) x++; else if (txy) y++; else if (ty