SlideShare a Scribd company logo
I just need code for processQueue function using iterators from the linkedList class.
#include
#include
#include
#include
#include "Queuecpp.h"
#include "Songcpp.h"
#include "RequestCpp.h"
void populateRequests(Queue& q);
void populateSongDataBase(LinkedList &list);
void processQueue(LinkedList &list,Queue& q);
void processRequest(std::string action, std::string title,std::string singer,int chartPos);
//GIVEN
int main() {
LinkedList list;
Queue q;
populateSongDataBase(list); // fill the Songs Data Base into Linked List
std::cout<<"*************************************n";
list.printList(); //
std::cout<<"*************************************n";
populateRequests(q); // fill the request q
std::cout<<"n";
std::cout<<"---------------PRINTING QUEUE-------------------n";
q.printList();
std::cout<<"------------------------------------n";
processQueue(list,q); // process the requests
std::cout<<"*************************************n";
list.printList();
std::cout<<"*************************************n";
}
//GIVEN
//Requires an empty linked list
//Effects fills the list with request by reading from the RequestData.txt
//Modifies the queue by filling it
void populateRequests(Queue &q){
}
//GIVEN
//Requires Filled data base , song to play
//Effects Finds song using get, if found plays it
//Modifies nothing
std::string playSong(LinkedList&list, Song s){
if (list.get(s)>=0){
return "PLAYING :"+ s.toString()+"n";
}
else{
return "SONG NOT FOUNDn";
}
}
//GIVEN
//Requires filled database
//Effects calls print methood to print top ten songs
//Modifies nothing
void printTopTenSongs(LinkedList& list){
std::cout<<"PLAYING TOP TEN SONG __________n";
list.print(10);
;
}
//Requires filled Song Database, a Song to add. The chart position given in the song is where it
will get added. Note this is a Song that is not supposed to exist in database.
//Effects adds the song from its original chart position
//Modifies the Song database. Adjust chart position of all Songs affected by this addition- this
adjustment is done in insert method using adjustPosition method. If the Process Queue adds a
Song that already is in the database, then a duplicate entry can occur.
//TODO
void addThisSong(LinkedList &list, Song s){
//TODO
/* Use this code
if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){
/* Use this code
if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT
"< &list, Song s, int pos){
int chartPos=list.get(s);
std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int
chartPos){
Song s(title,singer,chartPos);
char ch =action[0];
switch(ch){
case 'P' : std::cout< &list ,Queue& q){
int requestNumber=1;
//Create an iterator for the Queue to iteratate through requests
std::cout<<"-------------------------------------------------------------------------n";
// call processRequest
std::cout<<"-------------------------------------------------------------------------n"
std::cout<<"-------------------------------------------------------------------------n";
}
//GIVEN
//Requires the empty linked list database
//Effects if the file exists and accessible, reads from file and inserts songs
// IN SORTED ORDER ACCORDING TO CHART POSITION// Big O(N^2) ---> Why?
//Modifies list - fills it with songs, returns sorted linked list
void populateSongDataBase(LinkedList &list){
std::string line="";
std::string token="";
std::string title="";
std::string singer="";
int chartPos=-1;
try {
std::ifstream input("SongsData.txt");
if (input.fail())
throw new std::string("FILE OPEN ERROR EXCEPTION n");
else{
while (getline(input,line)){
std::istringstream instream(line);
getline(instream,title,',');
getline(instream,singer,',');
instream>>chartPos;
Song s(title,singer,chartPos);
list.insert(s);
}
}
}
catch(std::string message){
std::cout<
#include
#include
#include
#include "Queuecpp.h"
#include "Songcpp.h"
#include "RequestCpp.h"
void populateRequests(Queue& q);
void populateSongDataBase(LinkedList &list);
void processQueue(LinkedList &list,Queue& q);
void processRequest(std::string action, std::string title,std::string singer,int chartPos);
//GIVEN
int main() {
LinkedList list;
Queue q;
populateSongDataBase(list); // fill the Songs Data Base into Linked List
std::cout<<"*************************************n";
list.printList(); //
std::cout<<"*************************************n";
populateRequests(q); // fill the request q
std::cout<<"n";
std::cout<<"---------------PRINTING QUEUE-------------------n";
q.printList();
std::cout<<"------------------------------------n";
processQueue(list,q); // process the requests
std::cout<<"*************************************n";
list.printList();
std::cout<<"*************************************n";
}
//GIVEN
//Requires an empty linked list
//Effects fills the list with request by reading from the RequestData.txt
//Modifies the queue by filling it
void populateRequests(Queue &q){
}
//GIVEN
//Requires Filled data base , song to play
//Effects Finds song using get, if found plays it
//Modifies nothing
std::string playSong(LinkedList&list, Song s){
if (list.get(s)>=0){
return "PLAYING :"+ s.toString()+"n";
}
else{
return "SONG NOT FOUNDn";
}
}
//GIVEN
//Requires filled database
//Effects calls print methood to print top ten songs
//Modifies nothing
void printTopTenSongs(LinkedList& list){
std::cout<<"PLAYING TOP TEN SONG __________n";
list.print(10);
;
}
//TODO
void addThisSong(LinkedList &list, Song s){
//TODO
/* Use this code
if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){
/* Use this code
if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT
"< &list, Song s, int pos){
int chartPos=list.get(s);
std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int
chartPos){
Song s(title,singer,chartPos);
char ch =action[0];
switch(ch){
case 'P' : std::cout< &list ,Queue& q){
int requestNumber=1;
//Create an iterator for the Queue to iteratate through requests
std::cout<<"-------------------------------------------------------------------------n";
// call processRequest
std::cout<<"-------------------------------------------------------------------------n"
std::cout<<"-------------------------------------------------------------------------n";
}
//GIVEN
void populateSongDataBase(LinkedList &list){
}

More Related Content

Similar to I just need code for processQueue function using iterators from the .pdf

prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx
prog-03.pdfCSci 430 Programming Project #3Deadlock De.docxprog-03.pdfCSci 430 Programming Project #3Deadlock De.docx
prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx
stilliegeorgiana
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
Gleicon Moraes
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ajoy21
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
Abdulrahman890100
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
ShiraPrater50
 
PostgreSQL Portland Performance Practice Project - Database Test 2 Howto
PostgreSQL Portland Performance Practice Project - Database Test 2 HowtoPostgreSQL Portland Performance Practice Project - Database Test 2 Howto
PostgreSQL Portland Performance Practice Project - Database Test 2 Howto
Mark Wong
 
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方計算機性能の限界点とその考え方
計算機性能の限界点とその考え方
Naoto MATSUMOTO
 
FunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - StreamsFunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - Streams
darach
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
Mohammad Reza Kamalifard
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Sages
 
Need help implementing the skeleton code below, I have provided the .pdf
Need help implementing the skeleton code below, I have provided the .pdfNeed help implementing the skeleton code below, I have provided the .pdf
Need help implementing the skeleton code below, I have provided the .pdf
ezzi552
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
Dale Lane
 
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxPart APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
dewhirstichabod
 
Complete the C++ program and implement the routines that are not .docx
  Complete the C++ program and implement the routines that are not .docx  Complete the C++ program and implement the routines that are not .docx
Complete the C++ program and implement the routines that are not .docx
Abdulrahman890100
 

Similar to I just need code for processQueue function using iterators from the .pdf (20)

prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx
prog-03.pdfCSci 430 Programming Project #3Deadlock De.docxprog-03.pdfCSci 430 Programming Project #3Deadlock De.docx
prog-03.pdfCSci 430 Programming Project #3Deadlock De.docx
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message Queue
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
Complete the C++ program and implement the routines that are n.docx
    Complete the C++ program and implement the routines that are n.docx    Complete the C++ program and implement the routines that are n.docx
Complete the C++ program and implement the routines that are n.docx
 
PostgreSQL Portland Performance Practice Project - Database Test 2 Howto
PostgreSQL Portland Performance Practice Project - Database Test 2 HowtoPostgreSQL Portland Performance Practice Project - Database Test 2 Howto
PostgreSQL Portland Performance Practice Project - Database Test 2 Howto
 
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方計算機性能の限界点とその考え方
計算機性能の限界点とその考え方
 
FunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - StreamsFunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - Streams
 
Pycon - Python for ethical hackers
Pycon - Python for ethical hackers Pycon - Python for ethical hackers
Pycon - Python for ethical hackers
 
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash courseCodepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
Codepot - Pig i Hive: szybkie wprowadzenie / Pig and Hive crash course
 
Need help implementing the skeleton code below, I have provided the .pdf
Need help implementing the skeleton code below, I have provided the .pdfNeed help implementing the skeleton code below, I have provided the .pdf
Need help implementing the skeleton code below, I have provided the .pdf
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docxPart APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
 
Complete the C++ program and implement the routines that are not .docx
  Complete the C++ program and implement the routines that are not .docx  Complete the C++ program and implement the routines that are not .docx
Complete the C++ program and implement the routines that are not .docx
 

More from allurafashions98

Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
 Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
allurafashions98
 
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
 Current Attempt in Progress Waterway Company uses a periodic inventor.pdf Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
allurafashions98
 
Current Attempt in Progress The comparative balance.pdf
 Current Attempt in Progress The comparative balance.pdf Current Attempt in Progress The comparative balance.pdf
Current Attempt in Progress The comparative balance.pdf
allurafashions98
 
Current Attempt in Progress Novaks Market recorded the following eve.pdf
 Current Attempt in Progress Novaks Market recorded the following eve.pdf Current Attempt in Progress Novaks Market recorded the following eve.pdf
Current Attempt in Progress Novaks Market recorded the following eve.pdf
allurafashions98
 
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
 Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
allurafashions98
 
Define a class called Disk with two member variables, an int called.pdf
 Define a class called Disk with two member variables, an int called.pdf Define a class called Disk with two member variables, an int called.pdf
Define a class called Disk with two member variables, an int called.pdf
allurafashions98
 
Define to be the median of the Exponential () distribution. That is,.pdf
 Define  to be the median of the Exponential () distribution. That is,.pdf Define  to be the median of the Exponential () distribution. That is,.pdf
Define to be the median of the Exponential () distribution. That is,.pdf
allurafashions98
 
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
 Dedewine the bridthenes tar this test Choose the conist answet below .pdf Dedewine the bridthenes tar this test Choose the conist answet below .pdf
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
allurafashions98
 
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
 Davenport Incorporated has two divisions, Howard and Jones. The f.pdf Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
allurafashions98
 
Data tableRequirements 1. Prepare the income statement for the mon.pdf
 Data tableRequirements 1. Prepare the income statement for the mon.pdf Data tableRequirements 1. Prepare the income statement for the mon.pdf
Data tableRequirements 1. Prepare the income statement for the mon.pdf
allurafashions98
 
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
 Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
allurafashions98
 
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
 Data tableAfter researching the competitors of EJH Enterprises, yo.pdf Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
allurafashions98
 
Current Attempt in Progress If a qualitative variable has c categ.pdf
 Current Attempt in Progress If a qualitative variable has  c  categ.pdf Current Attempt in Progress If a qualitative variable has  c  categ.pdf
Current Attempt in Progress If a qualitative variable has c categ.pdf
allurafashions98
 
Data tableData tableThe figures to the right show the BOMs for .pdf
 Data tableData tableThe figures to the right show the BOMs for .pdf Data tableData tableThe figures to the right show the BOMs for .pdf
Data tableData tableThe figures to the right show the BOMs for .pdf
allurafashions98
 
Data table Requirements 1. Compute the product cost per meal produced.pdf
 Data table Requirements 1. Compute the product cost per meal produced.pdf Data table Requirements 1. Compute the product cost per meal produced.pdf
Data table Requirements 1. Compute the product cost per meal produced.pdf
allurafashions98
 
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
 Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
allurafashions98
 
Daniel, age 38 , is single and has the following income and exnencac .pdf
 Daniel, age 38 , is single and has the following income and exnencac .pdf Daniel, age 38 , is single and has the following income and exnencac .pdf
Daniel, age 38 , is single and has the following income and exnencac .pdf
allurafashions98
 
Danny Anderson admired his wifes success at selling scarves at local.pdf
 Danny Anderson admired his wifes success at selling scarves at local.pdf Danny Anderson admired his wifes success at selling scarves at local.pdf
Danny Anderson admired his wifes success at selling scarves at local.pdf
allurafashions98
 
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
 CX Enterprises has the following expected dividends $1.05 in one yea.pdf CX Enterprises has the following expected dividends $1.05 in one yea.pdf
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
allurafashions98
 
Daring the financial crisis an the end of the firs decade of the 2000.pdf
 Daring the financial crisis an the end of the firs decade of the 2000.pdf Daring the financial crisis an the end of the firs decade of the 2000.pdf
Daring the financial crisis an the end of the firs decade of the 2000.pdf
allurafashions98
 

More from allurafashions98 (20)

Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
 Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
Current Attempt in Progress. At December 31, 2024, Culiumber Imports .pdf
 
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
 Current Attempt in Progress Waterway Company uses a periodic inventor.pdf Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
Current Attempt in Progress Waterway Company uses a periodic inventor.pdf
 
Current Attempt in Progress The comparative balance.pdf
 Current Attempt in Progress The comparative balance.pdf Current Attempt in Progress The comparative balance.pdf
Current Attempt in Progress The comparative balance.pdf
 
Current Attempt in Progress Novaks Market recorded the following eve.pdf
 Current Attempt in Progress Novaks Market recorded the following eve.pdf Current Attempt in Progress Novaks Market recorded the following eve.pdf
Current Attempt in Progress Novaks Market recorded the following eve.pdf
 
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
 Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
Current Attempt in Progress Ivanhoe Corporation reported the followin.pdf
 
Define a class called Disk with two member variables, an int called.pdf
 Define a class called Disk with two member variables, an int called.pdf Define a class called Disk with two member variables, an int called.pdf
Define a class called Disk with two member variables, an int called.pdf
 
Define to be the median of the Exponential () distribution. That is,.pdf
 Define  to be the median of the Exponential () distribution. That is,.pdf Define  to be the median of the Exponential () distribution. That is,.pdf
Define to be the median of the Exponential () distribution. That is,.pdf
 
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
 Dedewine the bridthenes tar this test Choose the conist answet below .pdf Dedewine the bridthenes tar this test Choose the conist answet below .pdf
Dedewine the bridthenes tar this test Choose the conist answet below .pdf
 
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
 Davenport Incorporated has two divisions, Howard and Jones. The f.pdf Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
Davenport Incorporated has two divisions, Howard and Jones. The f.pdf
 
Data tableRequirements 1. Prepare the income statement for the mon.pdf
 Data tableRequirements 1. Prepare the income statement for the mon.pdf Data tableRequirements 1. Prepare the income statement for the mon.pdf
Data tableRequirements 1. Prepare the income statement for the mon.pdf
 
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
 Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
Current Attempt in Progress Items from Oriole Companys budget for Ma.pdf
 
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
 Data tableAfter researching the competitors of EJH Enterprises, yo.pdf Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
Data tableAfter researching the competitors of EJH Enterprises, yo.pdf
 
Current Attempt in Progress If a qualitative variable has c categ.pdf
 Current Attempt in Progress If a qualitative variable has  c  categ.pdf Current Attempt in Progress If a qualitative variable has  c  categ.pdf
Current Attempt in Progress If a qualitative variable has c categ.pdf
 
Data tableData tableThe figures to the right show the BOMs for .pdf
 Data tableData tableThe figures to the right show the BOMs for .pdf Data tableData tableThe figures to the right show the BOMs for .pdf
Data tableData tableThe figures to the right show the BOMs for .pdf
 
Data table Requirements 1. Compute the product cost per meal produced.pdf
 Data table Requirements 1. Compute the product cost per meal produced.pdf Data table Requirements 1. Compute the product cost per meal produced.pdf
Data table Requirements 1. Compute the product cost per meal produced.pdf
 
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
 Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
Darla, Ellen, and Frank have capital balances of $30,000,$40,000 and .pdf
 
Daniel, age 38 , is single and has the following income and exnencac .pdf
 Daniel, age 38 , is single and has the following income and exnencac .pdf Daniel, age 38 , is single and has the following income and exnencac .pdf
Daniel, age 38 , is single and has the following income and exnencac .pdf
 
Danny Anderson admired his wifes success at selling scarves at local.pdf
 Danny Anderson admired his wifes success at selling scarves at local.pdf Danny Anderson admired his wifes success at selling scarves at local.pdf
Danny Anderson admired his wifes success at selling scarves at local.pdf
 
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
 CX Enterprises has the following expected dividends $1.05 in one yea.pdf CX Enterprises has the following expected dividends $1.05 in one yea.pdf
CX Enterprises has the following expected dividends $1.05 in one yea.pdf
 
Daring the financial crisis an the end of the firs decade of the 2000.pdf
 Daring the financial crisis an the end of the firs decade of the 2000.pdf Daring the financial crisis an the end of the firs decade of the 2000.pdf
Daring the financial crisis an the end of the firs decade of the 2000.pdf
 

Recently uploaded

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 

Recently uploaded (20)

Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 

I just need code for processQueue function using iterators from the .pdf

  • 1. I just need code for processQueue function using iterators from the linkedList class. #include #include #include #include #include "Queuecpp.h" #include "Songcpp.h" #include "RequestCpp.h" void populateRequests(Queue& q); void populateSongDataBase(LinkedList &list); void processQueue(LinkedList &list,Queue& q); void processRequest(std::string action, std::string title,std::string singer,int chartPos); //GIVEN int main() { LinkedList list; Queue q; populateSongDataBase(list); // fill the Songs Data Base into Linked List std::cout<<"*************************************n"; list.printList(); // std::cout<<"*************************************n"; populateRequests(q); // fill the request q std::cout<<"n"; std::cout<<"---------------PRINTING QUEUE-------------------n"; q.printList(); std::cout<<"------------------------------------n"; processQueue(list,q); // process the requests std::cout<<"*************************************n"; list.printList(); std::cout<<"*************************************n"; }
  • 2. //GIVEN //Requires an empty linked list //Effects fills the list with request by reading from the RequestData.txt //Modifies the queue by filling it void populateRequests(Queue &q){ } //GIVEN //Requires Filled data base , song to play //Effects Finds song using get, if found plays it //Modifies nothing std::string playSong(LinkedList&list, Song s){ if (list.get(s)>=0){ return "PLAYING :"+ s.toString()+"n"; } else{ return "SONG NOT FOUNDn"; } } //GIVEN //Requires filled database //Effects calls print methood to print top ten songs //Modifies nothing void printTopTenSongs(LinkedList& list){ std::cout<<"PLAYING TOP TEN SONG __________n"; list.print(10); ; } //Requires filled Song Database, a Song to add. The chart position given in the song is where it will get added. Note this is a Song that is not supposed to exist in database. //Effects adds the song from its original chart position
  • 3. //Modifies the Song database. Adjust chart position of all Songs affected by this addition- this adjustment is done in insert method using adjustPosition method. If the Process Queue adds a Song that already is in the database, then a duplicate entry can occur. //TODO void addThisSong(LinkedList &list, Song s){ //TODO /* Use this code if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){ /* Use this code if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT "< &list, Song s, int pos){ int chartPos=list.get(s); std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int chartPos){ Song s(title,singer,chartPos); char ch =action[0]; switch(ch){ case 'P' : std::cout< &list ,Queue& q){ int requestNumber=1; //Create an iterator for the Queue to iteratate through requests std::cout<<"-------------------------------------------------------------------------n"; // call processRequest std::cout<<"-------------------------------------------------------------------------n" std::cout<<"-------------------------------------------------------------------------n"; } //GIVEN //Requires the empty linked list database //Effects if the file exists and accessible, reads from file and inserts songs // IN SORTED ORDER ACCORDING TO CHART POSITION// Big O(N^2) ---> Why?
  • 4. //Modifies list - fills it with songs, returns sorted linked list void populateSongDataBase(LinkedList &list){ std::string line=""; std::string token=""; std::string title=""; std::string singer=""; int chartPos=-1; try { std::ifstream input("SongsData.txt"); if (input.fail()) throw new std::string("FILE OPEN ERROR EXCEPTION n"); else{ while (getline(input,line)){ std::istringstream instream(line); getline(instream,title,','); getline(instream,singer,','); instream>>chartPos; Song s(title,singer,chartPos); list.insert(s); } } } catch(std::string message){ std::cout< #include #include #include #include "Queuecpp.h" #include "Songcpp.h" #include "RequestCpp.h" void populateRequests(Queue& q); void populateSongDataBase(LinkedList &list); void processQueue(LinkedList &list,Queue& q); void processRequest(std::string action, std::string title,std::string singer,int chartPos); //GIVEN
  • 5. int main() { LinkedList list; Queue q; populateSongDataBase(list); // fill the Songs Data Base into Linked List std::cout<<"*************************************n"; list.printList(); // std::cout<<"*************************************n"; populateRequests(q); // fill the request q std::cout<<"n"; std::cout<<"---------------PRINTING QUEUE-------------------n"; q.printList(); std::cout<<"------------------------------------n"; processQueue(list,q); // process the requests std::cout<<"*************************************n"; list.printList(); std::cout<<"*************************************n"; } //GIVEN //Requires an empty linked list //Effects fills the list with request by reading from the RequestData.txt //Modifies the queue by filling it void populateRequests(Queue &q){ } //GIVEN //Requires Filled data base , song to play //Effects Finds song using get, if found plays it //Modifies nothing std::string playSong(LinkedList&list, Song s){ if (list.get(s)>=0){
  • 6. return "PLAYING :"+ s.toString()+"n"; } else{ return "SONG NOT FOUNDn"; } } //GIVEN //Requires filled database //Effects calls print methood to print top ten songs //Modifies nothing void printTopTenSongs(LinkedList& list){ std::cout<<"PLAYING TOP TEN SONG __________n"; list.print(10); ; } //TODO void addThisSong(LinkedList &list, Song s){ //TODO /* Use this code if (found>=0) {std::cout<<"ADDED THIS SONG "< &list, Song s){ /* Use this code if (found>=0) {std::cout<<"SORRY CANNOT REMOVE THIS SONG - STILL FOUND AT "< &list, Song s, int pos){ int chartPos=list.get(s); std::cout<<"MOVING SONG "< &list,std::string action, std::string title,std::string singer,int chartPos){ Song s(title,singer,chartPos); char ch =action[0]; switch(ch){
  • 7. case 'P' : std::cout< &list ,Queue& q){ int requestNumber=1; //Create an iterator for the Queue to iteratate through requests std::cout<<"-------------------------------------------------------------------------n"; // call processRequest std::cout<<"-------------------------------------------------------------------------n" std::cout<<"-------------------------------------------------------------------------n"; } //GIVEN void populateSongDataBase(LinkedList &list){ }