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, //.... ] }
_______________________
Write a TestVideoList class to test the class VideoList. This class should have a main method in which you perform the following actions: Create a VideoList object Insert 3 VideoNode objects at the end of the created list (from some producers like Sony Pictures, Universal Studios, Warner Bros., Star Films) Insert 4 VideoNode objects at the front of the list, Insert 3 VideoNode objects at the following positions of the list respectively: 0, 4, 8. Print the content of your list Find out in the list the items that have a price greater than 200. Print them out. Remove the first element of the list Remove the item at index 4 Print again the content of your list, Print out the average price of all Videos in the list Print out the average price of all Videos in the list from the Producer Sony Pictures. For each operation above, print a small message that describes the operation you are doing. For example: System.out.println(Insertion of 4 Video nodes at the end of the list);
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started