Question: 05. Fifth Assignment Utility Methods For this assignment well be doing problems 19.3 and 19.4 from your textbook. Problem 19.3 asks you to write a
05. Fifth Assignment Utility Methods
For this assignment well be doing problems 19.3 and 19.4 from your textbook. Problem 19.3 asks you to write a generic method that removes duplicate items from an ArrayList. This should be fairly straightforward. Problem 19.4 asks you to implement a generic method for linear search.
You can write your two methods in a new class called Utilities. Please include a main method for this class that tests your methods. Think carefully about the way you test your program. Developing a good test plan is as important as developing the code itself. Obviously, you should show that your generic methods work for different types of objects, i.e. ArrayLists or arrays of Integers, Strings, FacebookUsers, etc. You should also test any unusual cases you can think of: What if the ArrayList or array is empty? What if it contains only one item? What if your removeDuplicates method is passed an ArrayList in which every item is identical? And so on.
You will be graded according to the following rubric (each item is worth one point):
- The removeDuplicates method works on at least some input
- The removeDuplicates method is generic and therefore works on ArrayLists of all types of classes
- The linearSearch method works on at least some input
- The linearSearch method is generic and therefore works on ArrayLists of all types of classes that implement the Comparable interface
- There is a main method that tests the operation of the removeDuplicates and linearSearch methods
- The main method shows the operation of the removeDuplicates and linearSearch method on various types of classes, including FacebookUsers
- The test cases in the main method are logical and thorough
- The program compiles
- The program runs
- The program is clearly written and follows standard coding conventions
- Note: If your program does not compile, you will receive a score of 0 on the entire assignment
- Note: If you program compiles but does not run, you will receive a score of 0 on the entire assignment
- Note: If your Eclipse project is not exported and uploaded to the eLearn drop box correctly, you will receive a score of 0 on the entire assignment
- Note: If you do not submit code that solves the problem for this particular assignment, you will not receive any points for the programs compiling, the programs running, or following standard coding conventions.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
