Question: In java Please Write a Video node node class, called VideoNode, to hold the following information about a Video: code (as a String) title (as
In java Please
Write a Video node node class, called VideoNode, to hold the following information about a Video: code (as a String) title (as a String) producer (as a String) price (as double) VideoNode should have constructors and methods (getters, setters, and toString()) to manage the above information as well as the link to next and prev (previous) nodes in the list.
Write the VideoList class to hold objects of the class VideoNode. This class should define: Two instance variables first and last to keep the reference (address) of the first and last nodes of the list. (These are the only variables of this class). The VideoList class should implement the following interface: public interface VideoIF { public boolean isEmpty(); // returns true if the list is empty, false otherwise public int size(); // returns the number of items in the list public VideoNode getNodeAt(int index); //returns the VideoNode object at the specified index public void setNodeAt(VideoNode item, int index); //modify the information of the node at the given index (if // it a valid index) in the list with information from // the VideoNode object given as parameter if it is a //valid object public void addFirst(VideoNode item); // adds a Video node at the front of the list public void addLast(VideoNode item); // adds a Video node at the end of the list public void addAt(VideoNode item, int index); // adds a Video node to the list at the given index public String removeAt(int index); // removes the Video node from the list at the given index public int indexOf(VideoNode item); // returns the index of the first Video node in the list whose // data equals the given item data public ArrayList searchPriceGreaterThan(double p); //search and return an arraylist of VideoNode items having a //price greater than p public double averagePrice(); // return the average price of the Video nodes in the list public double averageProducerPrice(String producer); // return the average price of the Video nodes in the list //from the producer given as a parameter (e.g., Sony //Pictures or World Wide Pictures) public String toString(); // implement a toString() method that prints the list in the // format: //[ size: the_size_of_the_list // Video node1, // Video node2, //.... ] }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
