Question: why i have error in this code in Track: class Node { Track data; Node prev; Node next; public Node ( Track data ) {
why i have error in this code in "Track":
class Node
Track data;
Node prev;
Node next;
public NodeTrack data
this.data data;
class DoublyCircularLinkedList
Node head;
Node tail;
Add track to the end of the playlist
public void addTrackTrack track
Node newNode new Nodetrack;
if head null
head newNode;
tail newNode;
newNode.next newNode;
newNode.prev newNode;
else
tail.next newNode;
newNode.prev tail;
newNode.next head;
head.prev newNode;
tail newNode;
Remove track from the playlist
public void removeTrackTrack track
if head null
return;
Node current head;
do
if currentdata.equalstrack
if current head
head current.next;
if current tail
tail current.prev;
current.prev.next current.next;
current.next.prev current.prev;
return;
current current.next;
while current head;
Skip to the next track
public void skip
if head null
head head.next;
Get the current track
public Track getCurrentTrack
if head null
return head.data;
return null;
Display the playlist
public void displayPlaylist
if head null
System.out.printlnPlaylist is empty.";
return;
Node current head;
do
System.out.printlncurrentdata;
current current.next;
while current head;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
