Answered step by step
Verified Expert Solution
Question
1 Approved Answer
what is the answer for question 2? A video rental company would like to implement its registry of videos as a doubly linked list, called
what is the answer for question 2?
A video rental company would like to implement its registry of videos as a doubly linked list, called VideoList. 1. Write a Video node node class, called Video Node, 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. 2. 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(); 71 returns true if the list is empty, false otherwise public int size(); 11 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); 1/modify the information of the node at the given index (if // it a valid index) in the list with information from 11 the VideoNode object given as parameter if it is a //valid object public void addFirst (VideoNode item); 11 adds a video node at the front of the list public void addLast (VideoNode item); 11 adds a video node at the end of the list public void addAt (VideoNode item, int index); 71 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); 1/ returns the index of the first Video node in the list whose // data equals the given item data public ArrayListStep 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