CAN YOU HELP ME TO SOLVE THIS Assignment....
PLEASE....

THIS IS THE QUESTION :
Implement the linkedPriorityQueue class as defined below. Note the following:
 Each node in linkedPriorityQueue represents a customer. A customer can be regular or
with a high priority. High-priority customers have their high_priority variable set to true
while regular customers have their high_priority variable set to false.
 To implement the idea of a priority queue, class linkedPriorityQueue maintains two
queues: one for high-priority customers (implemented using the high_priority_front
and high_priority_rear pointers) and one for regular customers (implemented using the
queue_front and queue_rear pointers).
 When adding a new customer, both the customer’s number and his/her priority level is
provided. The customer should be added to the appropriate queue based on his/her priority.
 When serving (deleting) a customer, high-priority customers are considered first (i.e., a regular
customer cannot be served while a high-priority customer is waiting).
 The front function returns the number of the high-priority customer who has been waiting the
most, while the back function returns the number of the regular customer who has been
waiting the least.
 The print function prints the contents of the queue starting with high-priority customers (see
the example below).
 The size function takes a boolean argument, high_priority, and returns the number of
high-priority customers in the queue if high_priority is true and the number of regular
customers otherwise.
 Do not forget to include proper documentation for your code. 10% of your grade depends on
the documentation. Each function and each variable must be accompanied with a comment
describing its functionality. Do not forget to include your name, ID and section in each file you
submit.
 The provided main function is for testing/grading purposes. The only modification allowed on
this function is to comment/uncomment parts of it for debugging purposes.
 Your program should compile correctly. Submissions with compilation errors will not be
accepted.
 Included below is the expected output of the main function.
Good Luck!

THIS IS MAIN FOR HELP TO FIND THE SOLUTION

#include <iostream>
#include <cassert>
using namespace std;
struct node {
int number;
bool high_priority;
node *link;
;{
class linkedPriorityQueue {
private:
node *high_priority_front,
*high_priority_rear,
*queue_front,
*queue_rear;
public:
linkedPriorityQueue();
void addQueue( int number, bool high_priority );
void deleteQueue();
int front();
int back();
bool empty();
bool full();
void print();
int size( bool high_priority);
~linkedPriorityQueue();
;{
int main() {
bool t;
int i, j;
linkedPriorityQueue q1;
for( i = 0; i < 9; i++ ) {
t = bool( rand() % 2 );
q1.addQueue( i, t );
cout<<"Customer "<<i<<( t ? " with high-priority " : " " )<<"aded to the queue."<<endl;
{
q1.addQueue( i, true );
cout<<"Customer "<<i<<" with high-priority aded to the queue."<<endl;
cout<<"\nThe number of high-priority customers is "<<q1.size( true )
<<",\nwhile the number of remaining customers is "<<q1.size( false )<<"."<<endl;
cout<<"\nCustomer number "<<q1.front()<<" is at the front of the queue,"
<<"\nwhile customer number "<<q1.back()<<" is at the end of the queue."<<endl;
cout<<endl;
q1.print();
j = q1.size( true ) + q1.size( false ) / 2;
for( i = 0; i < j; i++ )
q1.deleteQueue();
cout<<"\nAfter a few removals, the number of high-priority customers is "<<q1.size( true )
<<",\nwhile the number of remaining customers is "<<q1.size( false )<<"."<<endl;
cout<<"\nCustomer number "<<q1.front()<<" is at the front of the queue,"
<<"\nwhile customer number "<<q1.back()<<" is at the end of the queue."<<endl;
cout<<endl;
q1.print();
return 0;
{

Recommended Answers

All 5 Replies

I think it says somewhere in the posting rules that you're not going to be able to get people to just do your homework for you! If you have a particular, specific problem within this assignment (such as "when I try compiling my code, I get error X", or "I don't quite understand aspect Y of this code") then try asking that instead.

I have the solution from another web but I want another solution to Benefited from your experiences... any way thank you

Hi Lovey
This is the place you need to be for learning search for samples in Danie Web
there is so many sample's if you seen them all you can teach us some tricks.

Please just look and you will find.

Thanks
Awie

hi Awie....
this assignment very important for me ... but I didn't have time to solve it ... now the second exams started in my university .... and I have a lot of quiz & study every time .... so I wanted you to solve my problem ... any way I have the solution and it's enough but I thought you can help me ... this will be the last visit in this web ... maybe I must find another groups to give the solution directly and help me ...
thanks...

We're here to help, but you need to help yourself first. We guide to solutions, not hand them out on silver platters. Other than an easy 'A', of what benefit is it to you if we just give it to you? Answer: None. In fact, it's a hindrance to you. The best way to learn it is to think about it. You don't have to think about it if we give you a handout.

If you choose not to return it's your loss. You'll learn your stuff better here than elsewhere.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.