Question: 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
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 size - 0 The ComputerList class should implement the following interface: public interface CList public boolean isepty // returns true if the list opty, false otherwise pablic int listSize(): 1/ returns the number of items in the list public Computerede gotat (int index) // returns the computer de object at the specified index or null if the list is empty public void aderirst ComputerBiode item) ladds & 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 Coepute to the 1st at the veeldex public ComputerBiode search String code): 11 search and return the Computer with the given code publie ComputerNode) watche reater Than(int p) // search and return an array of the set of Computerode items //having a price greater than public String remove (int index): 7/ 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 & tostring) method that prints the list in the // formati / 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
