CPSC 215L Lab 4, 9/23/99 Due Thursday 9/30/99 For this lab you need to create several methods for manipulating linked lists. This will be the first of several labs dealing with lists, one of the most fundamental data strucutures in computer science. Use the program and classes (cell, intList) created in class as a model for your program. REMEMBER TO SWITCH ROLES WITH YOUR PARTNER FOR THE DIFFERENT PORTIONS OF THE ASSIGNMENT. Use the "print" method I defined to demonstrate each part of the assignment. 1. Write a method - public int length() - that returns the length of the list (the number of strings in the list). 2. Write a method public void randomize(int maxlength) // inside class intList That creates a random list of integers, and assigns it to "front". The "maxlength" argument is the maximum length of the list. Each integer in the list should be between 0 and 9. If n is greater than 0, then the expression (int) (Math.random() * n) will give you an integer between 0 and n-1. 3. Write a method - public int lastInt() - that returns the int at the END of the list. If the list is null, then return 0. 4. Write a method that returns the LARGEST integer in the list (you may assume that all numbers are greater than 0). Recall the "findmax" method I did in class prior to the first lab. 5. Write a method that will add a new integer to the END of the list. 6. Write a method that will delete the integer at the END of the list. Do NOT use the "length" method and the delete method I defined in class. That solution would be easy but inefficient because it will require traversing the list once. 7. EXTRA CREDIT: Define a method that will remove duplicate numbers from the list. Only one occurrence of a number should remain on the list. Turn in printouts of tests. You are required to test your methods on special case situations (e.g., when inserting into a null list).