SlideShare a Scribd company logo
It's not working what am I doing wrong?
Given main(), complete the SongNode class to include the printSongInfo() method. Then write
the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the
dummy head node.
Ex: If the input is:
the output is:
import java.util.Scanner;
public class Playlist {
// TODO: Write method to ouptut list of songs
public static void printPlaylist(SongNode songs){
SongNode song = song.getNext();
while (song != null) {
song.printSongInfo();
System.out.println();
song = song.getNext();
}
}
public static void main (String[] args) {
Scanner scnr = new Scanner(System.in);
SongNode headNode;
SongNode currNode;
SongNode lastNode;
String songTitle;
int songLength;
String songArtist;
// Front of nodes list
headNode = new SongNode();
lastNode = headNode;
// Read user input until -1 entered
songTitle = scnr.nextLine();
while (!songTitle.equals("-1")) {
songLength = scnr.nextInt();
scnr.nextLine();
songArtist = scnr.nextLine();
currNode = new SongNode(songTitle, songLength, songArtist);
lastNode.insertAfter(currNode);
lastNode = currNode;
songTitle = scnr.nextLine();
}
// Print linked list
System.out.println("LIST OF SONGS");
System.out.println("-------------");
printPlaylist(headNode);
}
}
public class SongNode {
private String songTitle;
private int songLength;
private String songArtist;
private SongNode nextNodeRef; // Reference to the next node
public SongNode() {
songTitle = "";
songLength = 0;
songArtist = "";
nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = null;
}
// Constructor
public SongNode(String songTitleInit, int songLengthInit, String songArtistInit, SongNode
nextLoc) {
this.songTitle = songTitleInit;
this.songLength = songLengthInit;
this.songArtist = songArtistInit;
this.nextNodeRef = nextLoc;
}
// insertAfter
public void insertAfter(SongNode nodeLoc) {
SongNode tmpNext;
tmpNext = this.nextNodeRef;
this.nextNodeRef = nodeLoc;
nodeLoc.nextNodeRef = tmpNext;
}
// Get location pointed by nextNodeRef
public SongNode getNext() {
return this.nextNodeRef;
}
// TODO: Write printSongInfo() method
public void printInfo(){
System.out.println("Title: " + songTitle);
System.out.println("Length: " + songLength);
System.out.println("Artist: " + songArtist);
}
}

More Related Content

Similar to It's not working what am I doing wrong- Given main()- complete the Son.pdf

maincpp include ltiostreamgt include ltstringgt.pdf
maincpp  include ltiostreamgt include ltstringgt.pdfmaincpp  include ltiostreamgt include ltstringgt.pdf
maincpp include ltiostreamgt include ltstringgt.pdf
mukulsingh0025
 
Can someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdfCan someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdf
akshpatil4
 
Program 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdfProgram 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdf
addtechglobalmarketi
 
I need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdfI need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdf
arihanthtextiles
 
Write a program in C++ language that implements a music play.pdf
Write a program in C++ language that implements a music play.pdfWrite a program in C++ language that implements a music play.pdf
Write a program in C++ language that implements a music play.pdf
iconsystemsslm
 
Program 01 For this program you will complete the program in.pdf
Program 01 For this program you will complete the program in.pdfProgram 01 For this program you will complete the program in.pdf
Program 01 For this program you will complete the program in.pdf
addtechglobalmarketi
 
Many of us have large digital music collections that are not always .pdf
Many of us have large digital music collections that are not always .pdfMany of us have large digital music collections that are not always .pdf
Many of us have large digital music collections that are not always .pdf
fazanmobiles
 
819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf
meenaaarika
 
In C++ please I need output please You will be building a .pdf
In C++ please I need output please   You will be building a .pdfIn C++ please I need output please   You will be building a .pdf
In C++ please I need output please You will be building a .pdf
sunilverma8487
 
Here is the code.compile g++ Playlist.cpp main.cppPlaylist.h.pdf
Here is the code.compile  g++ Playlist.cpp main.cppPlaylist.h.pdfHere is the code.compile  g++ Playlist.cpp main.cppPlaylist.h.pdf
Here is the code.compile g++ Playlist.cpp main.cppPlaylist.h.pdf
ANANDSALESINDIA105
 
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
arenamobiles123
 
Need help with this java project, as the methods are proving to be p.pdf
Need help with this java project, as the methods are proving to be p.pdfNeed help with this java project, as the methods are proving to be p.pdf
Need help with this java project, as the methods are proving to be p.pdf
prajeetjain
 
PLEASE I need help with my assignment I have to compelet .pdf
PLEASE I need help with my assignment I have to compelet  .pdfPLEASE I need help with my assignment I have to compelet  .pdf
PLEASE I need help with my assignment I have to compelet .pdf
ankit11134
 
PFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfPFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdf
mailadmin1
 
Structuring Music Using Linked Lists
Structuring Music Using Linked ListsStructuring Music Using Linked Lists
Structuring Music Using Linked ListsCynthia Marcello
 
Hi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdf
Hi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdfHi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdf
Hi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdf
apleathers
 
I am having the below compile errors. .pdf
I am having the below compile errors. .pdfI am having the below compile errors. .pdf
I am having the below compile errors. .pdf
dbrienmhompsonkath75
 
BeepComp - Chiptune Creator - User's Guide (v0.2.2)
BeepComp - Chiptune Creator - User's Guide (v0.2.2)BeepComp - Chiptune Creator - User's Guide (v0.2.2)
BeepComp - Chiptune Creator - User's Guide (v0.2.2)
Hiro Morozumi
 
For this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdfFor this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdf
herminaherman
 
a) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdfa) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdf
MAYANKBANSAL1981
 

Similar to It's not working what am I doing wrong- Given main()- complete the Son.pdf (20)

maincpp include ltiostreamgt include ltstringgt.pdf
maincpp  include ltiostreamgt include ltstringgt.pdfmaincpp  include ltiostreamgt include ltstringgt.pdf
maincpp include ltiostreamgt include ltstringgt.pdf
 
Can someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdfCan someone please help me implement the addSong function .pdf
Can someone please help me implement the addSong function .pdf
 
Program 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdfProgram 02 Based on the previous problem you should impleme.pdf
Program 02 Based on the previous problem you should impleme.pdf
 
I need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdfI need help writing the methods for the song and playList class in J.pdf
I need help writing the methods for the song and playList class in J.pdf
 
Write a program in C++ language that implements a music play.pdf
Write a program in C++ language that implements a music play.pdfWrite a program in C++ language that implements a music play.pdf
Write a program in C++ language that implements a music play.pdf
 
Program 01 For this program you will complete the program in.pdf
Program 01 For this program you will complete the program in.pdfProgram 01 For this program you will complete the program in.pdf
Program 01 For this program you will complete the program in.pdf
 
Many of us have large digital music collections that are not always .pdf
Many of us have large digital music collections that are not always .pdfMany of us have large digital music collections that are not always .pdf
Many of us have large digital music collections that are not always .pdf
 
819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf819 LAB Program Playlist c++ You will be building a li.pdf
819 LAB Program Playlist c++ You will be building a li.pdf
 
In C++ please I need output please You will be building a .pdf
In C++ please I need output please   You will be building a .pdfIn C++ please I need output please   You will be building a .pdf
In C++ please I need output please You will be building a .pdf
 
Here is the code.compile g++ Playlist.cpp main.cppPlaylist.h.pdf
Here is the code.compile  g++ Playlist.cpp main.cppPlaylist.h.pdfHere is the code.compile  g++ Playlist.cpp main.cppPlaylist.h.pdf
Here is the code.compile g++ Playlist.cpp main.cppPlaylist.h.pdf
 
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
8.15 Program Playlist (C++) You will be building a linked list. Mak.pdf
 
Need help with this java project, as the methods are proving to be p.pdf
Need help with this java project, as the methods are proving to be p.pdfNeed help with this java project, as the methods are proving to be p.pdf
Need help with this java project, as the methods are proving to be p.pdf
 
PLEASE I need help with my assignment I have to compelet .pdf
PLEASE I need help with my assignment I have to compelet  .pdfPLEASE I need help with my assignment I have to compelet  .pdf
PLEASE I need help with my assignment I have to compelet .pdf
 
PFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdfPFB cpp code for the given problem#include iostream #include .pdf
PFB cpp code for the given problem#include iostream #include .pdf
 
Structuring Music Using Linked Lists
Structuring Music Using Linked ListsStructuring Music Using Linked Lists
Structuring Music Using Linked Lists
 
Hi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdf
Hi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdfHi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdf
Hi,Please find the Ansswer below.PLAYLIST.h#include iostrea.pdf
 
I am having the below compile errors. .pdf
I am having the below compile errors. .pdfI am having the below compile errors. .pdf
I am having the below compile errors. .pdf
 
BeepComp - Chiptune Creator - User's Guide (v0.2.2)
BeepComp - Chiptune Creator - User's Guide (v0.2.2)BeepComp - Chiptune Creator - User's Guide (v0.2.2)
BeepComp - Chiptune Creator - User's Guide (v0.2.2)
 
For this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdfFor this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdf
 
a) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdfa) Complete both insert and delete methods. If it works correctly 10.pdf
a) Complete both insert and delete methods. If it works correctly 10.pdf
 

More from aanyajoshi90

Jamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdf
Jamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdfJamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdf
Jamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdf
aanyajoshi90
 
Jake stole a suspension of Bacillus anthracis with a known concentrati.pdf
Jake stole a suspension of Bacillus anthracis with a known concentrati.pdfJake stole a suspension of Bacillus anthracis with a known concentrati.pdf
Jake stole a suspension of Bacillus anthracis with a known concentrati.pdf
aanyajoshi90
 
Ivanhoe arovides shutile service between 4 hotels near a medical cente.pdf
Ivanhoe arovides shutile service between 4 hotels near a medical cente.pdfIvanhoe arovides shutile service between 4 hotels near a medical cente.pdf
Ivanhoe arovides shutile service between 4 hotels near a medical cente.pdf
aanyajoshi90
 
its about the economic systems of Haiti XI- Economic Policies and Refo.pdf
its about the economic systems of Haiti XI- Economic Policies and Refo.pdfits about the economic systems of Haiti XI- Economic Policies and Refo.pdf
its about the economic systems of Haiti XI- Economic Policies and Refo.pdf
aanyajoshi90
 
IV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdf
IV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdfIV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdf
IV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdf
aanyajoshi90
 
its about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdf
its about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdfits about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdf
its about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdf
aanyajoshi90
 
Its in C++ and do not use int pls Given a string- return a new string.pdf
Its in C++ and do not use int pls Given a string- return a new string.pdfIts in C++ and do not use int pls Given a string- return a new string.pdf
Its in C++ and do not use int pls Given a string- return a new string.pdf
aanyajoshi90
 
it were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdf
it were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdfit were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdf
it were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdf
aanyajoshi90
 
j-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdfj-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdf
aanyajoshi90
 
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdfIvanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
aanyajoshi90
 
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdfJocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
aanyajoshi90
 
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdfJoe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
aanyajoshi90
 
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdfJoan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
aanyajoshi90
 
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdfITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
aanyajoshi90
 
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdfIvanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
aanyajoshi90
 
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdfJennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
aanyajoshi90
 
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdfJeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
aanyajoshi90
 
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdfJCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
aanyajoshi90
 
Jenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdfJenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdf
aanyajoshi90
 
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdfJBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
aanyajoshi90
 

More from aanyajoshi90 (20)

Jamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdf
Jamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdfJamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdf
Jamal has red hair- Since the gene for red hair is recessive- Jamal mu.pdf
 
Jake stole a suspension of Bacillus anthracis with a known concentrati.pdf
Jake stole a suspension of Bacillus anthracis with a known concentrati.pdfJake stole a suspension of Bacillus anthracis with a known concentrati.pdf
Jake stole a suspension of Bacillus anthracis with a known concentrati.pdf
 
Ivanhoe arovides shutile service between 4 hotels near a medical cente.pdf
Ivanhoe arovides shutile service between 4 hotels near a medical cente.pdfIvanhoe arovides shutile service between 4 hotels near a medical cente.pdf
Ivanhoe arovides shutile service between 4 hotels near a medical cente.pdf
 
its about the economic systems of Haiti XI- Economic Policies and Refo.pdf
its about the economic systems of Haiti XI- Economic Policies and Refo.pdfits about the economic systems of Haiti XI- Economic Policies and Refo.pdf
its about the economic systems of Haiti XI- Economic Policies and Refo.pdf
 
IV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdf
IV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdfIV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdf
IV- The EXT3 file system of Linux uses a multiple index structure- If (1).pdf
 
its about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdf
its about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdfits about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdf
its about the economic systems of Haiti IX- Post-Duvalier (1986-Presen.pdf
 
Its in C++ and do not use int pls Given a string- return a new string.pdf
Its in C++ and do not use int pls Given a string- return a new string.pdfIts in C++ and do not use int pls Given a string- return a new string.pdf
Its in C++ and do not use int pls Given a string- return a new string.pdf
 
it were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdf
it were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdfit were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdf
it were the total dividends paid for 2022-Maniplo Cnorce 57-84 milion.pdf
 
j-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdfj-51119ji-01274i- mplify the sum.pdf
j-51119ji-01274i- mplify the sum.pdf
 
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdfIvanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
Ivanhoe Inc- wishes to accumulate $1-612-000 by December 31- 2035- to.pdf
 
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdfJocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
Jocelyn Rivers is a 68-year-old admitted for acute pulmonary edema- He.pdf
 
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdfJoe Newbie completed a test to inspect a sample of sales invoices to v.pdf
Joe Newbie completed a test to inspect a sample of sales invoices to v.pdf
 
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdfJoan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
Joan owns a citrus tree farm near Mesa- Arizona- Joan and her family h.pdf
 
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdfITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
ITN 298- Capstone Project 1- Describing WAN technologies- including VP.pdf
 
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdfIvanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
Ivanhoe Ltd- had the following account balances at December 31- 2024-P.pdf
 
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdfJennifer is an older Aboriginal client- She has lived in the city all.pdf
Jennifer is an older Aboriginal client- She has lived in the city all.pdf
 
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdfJeff is trying very hard to change his flat tire- He struggles to lift.pdf
Jeff is trying very hard to change his flat tire- He struggles to lift.pdf
 
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdfJCL Inc- is a major chip manufacturing firm that sells its products to.pdf
JCL Inc- is a major chip manufacturing firm that sells its products to.pdf
 
Jenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdfJenna is a flight attendant for an international carrier- In the summe.pdf
Jenna is a flight attendant for an international carrier- In the summe.pdf
 
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdfJBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
JBL Lab 9 (Applying Best Practices for Security Logging and Monitoring.pdf
 

Recently uploaded

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 

It's not working what am I doing wrong- Given main()- complete the Son.pdf

  • 1. It's not working what am I doing wrong? Given main(), complete the SongNode class to include the printSongInfo() method. Then write the Playlist class' printPlaylist() method to print all songs in the playlist. DO NOT print the dummy head node. Ex: If the input is: the output is: import java.util.Scanner; public class Playlist { // TODO: Write method to ouptut list of songs public static void printPlaylist(SongNode songs){ SongNode song = song.getNext(); while (song != null) { song.printSongInfo(); System.out.println(); song = song.getNext(); } } public static void main (String[] args) { Scanner scnr = new Scanner(System.in); SongNode headNode; SongNode currNode; SongNode lastNode; String songTitle; int songLength; String songArtist; // Front of nodes list headNode = new SongNode(); lastNode = headNode; // Read user input until -1 entered songTitle = scnr.nextLine(); while (!songTitle.equals("-1")) { songLength = scnr.nextInt(); scnr.nextLine(); songArtist = scnr.nextLine();
  • 2. currNode = new SongNode(songTitle, songLength, songArtist); lastNode.insertAfter(currNode); lastNode = currNode; songTitle = scnr.nextLine(); } // Print linked list System.out.println("LIST OF SONGS"); System.out.println("-------------"); printPlaylist(headNode); } } public class SongNode { private String songTitle; private int songLength; private String songArtist; private SongNode nextNodeRef; // Reference to the next node public SongNode() { songTitle = ""; songLength = 0; songArtist = ""; nextNodeRef = null; } // Constructor public SongNode(String songTitleInit, int songLengthInit, String songArtistInit) { this.songTitle = songTitleInit; this.songLength = songLengthInit; this.songArtist = songArtistInit; this.nextNodeRef = null; } // Constructor public SongNode(String songTitleInit, int songLengthInit, String songArtistInit, SongNode nextLoc) { this.songTitle = songTitleInit; this.songLength = songLengthInit; this.songArtist = songArtistInit; this.nextNodeRef = nextLoc; }
  • 3. // insertAfter public void insertAfter(SongNode nodeLoc) { SongNode tmpNext; tmpNext = this.nextNodeRef; this.nextNodeRef = nodeLoc; nodeLoc.nextNodeRef = tmpNext; } // Get location pointed by nextNodeRef public SongNode getNext() { return this.nextNodeRef; } // TODO: Write printSongInfo() method public void printInfo(){ System.out.println("Title: " + songTitle); System.out.println("Length: " + songLength); System.out.println("Artist: " + songArtist); } }