Answered step by step
Verified Expert Solution
Link Copied!

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?image text in transcribedimage text in transcribed

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 ArrayList searchPriceGreaterThan (double p); 1/ search and return an arraylist of VideoNode items having a 1/price greater than p public double averagePrice(); // return the average price of the Video nodes in the list public double average ProducerPrice (String producer); 1/ return the average price of the Video nodes in the list //from the producer given as a parameter "Sony //Pictures" or "World Wide Pictures") public String toString(); 7/ implement a toString() method that prints the list in the // format: 1/[ size: the_size_of_the_list // Video nodei, // Video node 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

LO1 Understand risk management and identify its components.

Answered: 1 week ago