Question: 3. Write a TestComputerList class to test the class ComputerList. This class should have a main method in which you perform the following actions: Create
3. Write a TestComputerList class to test the class ComputerList. This class should have a main method in which you perform the following actions: Create a ComputerList object, Insert 10 ComputerNode objects into the created Computer List Print the content of your computer list, Find out in the list the items that have a price greater than 3000. Print them out. Remove the first element of the list Remove the item at index 3 Print again the content of your Computer list Insert some duplicate Computers in the list Print again the content of your Computer list. Remove duplicates Print again the content of your Computer list, For each operation above, print a small message that describes the operation you are doing. For example: System.out.println("Insertion of 10 Computers in the list"); Submission Guidelines Make sure your Computer List class implements the interface as specified, ie your class should begin with public class ComputerList implements Chist. Submit your netbeans project file (with zip extension) that contains the 3 java classes: Computer Node.java, Computer List.java, and TestComputer List.java. The 3 classes should be in a package called: cshp319.Computerlist Your submitted file should be: Your eshp319 52 assignmentl.zip Put your ID and name at the top of each of the above 3 files. I will be testing your code, so make sure your code runs correctly. Submit a hardcopy report that contains the above 3 files. 2. Write the Computer List class to hold objects of the class ComputerNode. This class should define Two instance variables head and size. (size should be updated during insertions and removals from the list The constructor of the class is public Computertist bead - null: size - 0 The ComputerList class should implement the following interface: public interface CList public boolean i pty 1/ returns true if the list is empty. false otherwise pablic int listSize(): 1/ returns the number of ites in the list public Computerede gotat (int index) // returns the computer de object at the specified index or all it the list is empty public void aderirst Computerode item): // adds & Computer at the front of the list public void addLast Computerode item) // adds a Computer at the end of the list public void addat Cant index, Computer Node item); adds a Copate to the 15E at the given adex public Computer de search String code); Search and return the Computer with the given code publie ComputerNode) archicereater Than(int p) // search and return an array of the set of Computerode items //having a price greater than p public String remove (int index): 1/ removes the computer Fre the list that has the given index pablie String remove Computerode item) 11 removes the first item in the list whose data equals the given item data public void remove Duplicates) // removes the duplicates of every computer in the list nodes with the same data) @Override publie String tostring // implement toStringt ethod that points the list in the // format / Size: the size of the list // Computeri. 1/ Computer
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
