Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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;
how to import Track class?
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