SlideShare a Scribd company logo
1 of 7
Download to read offline
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.docxstilliegeorgiana
 
RestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueRestMQ - HTTP/Redis based Message Queue
RestMQ - HTTP/Redis based Message QueueGleicon 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.docxShiraPrater50
 
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.docxShiraPrater50
 
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.docxShiraPrater50
 
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.docxShiraPrater50
 
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.docxajoy21
 
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.docxShiraPrater50
 
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.docxShiraPrater50
 
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.docxAbdulrahman890100
 
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.docxShiraPrater50
 
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 HowtoMark Wong
 
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方計算機性能の限界点とその考え方
計算機性能の限界点とその考え方Naoto MATSUMOTO
 
FunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - StreamsFunctionalJS - May 2014 - Streams
FunctionalJS - May 2014 - Streamsdarach
 
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 courseSages
 
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 .pdfezzi552
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale 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.docxdewhirstichabod
 
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 .docxAbdulrahman890100
 

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 .pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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,.pdfallurafashions98
 
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 .pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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 .pdfallurafashions98
 
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.pdfallurafashions98
 
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 .pdfallurafashions98
 
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 .pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 
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.pdfallurafashions98
 

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

OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxCeline George
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital ManagementMBA Assignment Experts
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFVivekanand Anglo Vedic Academy
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxLimon Prince
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024Borja Sotomayor
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17Celine George
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnershipsexpandedwebsite
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxAdelaideRefugio
 

Recently uploaded (20)

OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"Mattingly "AI and Prompt Design: LLMs with NER"
Mattingly "AI and Prompt Design: LLMs with NER"
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 

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){ }