Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Statement Customers of the Muscat Group are required to come in once a month to handle personal business. Each customer gets 10 minutes with

Problem Statement Customers of the Muscat Group are required to come in once a month to handle personal business. Each customer gets 10 minutes with a consultant in order to complete their business. At the end of the 10 minutes the consultant ends the conversation with the current customer and invites a new customer who has been waiting to come. At this point the previous customer can say they have finished their business or they can determine if they must get back into the wait state. In order to ensure each customer is seen, each customer who repeatedly gets in line does so with a lower priority. That is, first time seen customers have a higher priority then the second attempt customers. The second attempt customers have a higher priority than the third attempt customers and so on.

Write a program that simulates this environment and asks the customers if they have finished or require more time with a consultant. NOTE: It is important to remember that you have to choose the appropriate data structures and members to represent a customer.

This is what i did so far, please try to work with my steps. read my comments to understand each line. and this program is in C++.

#include

#include

using namespace std;

class Muscat

{

private:

struct node

{

int priority = 1 //make highest priority equal to 1 and lowest 5 or make highest prority 5 and lowest 1.

int customerCode;

struct CustomerQueue *link;

}

int size;

int qFront;

int qRear;

customer* queue;

customerobj;

public:

Muscat();

~Muscat();

void enqueue();

customer* deque();

bool isFull();

bool isEmpty();

void makeEmpty();

bool priorityNum();

};

int main()

{

Muscat::Muscat()

{

qFront = NULL; //constructor

size = 0;

}

bool Muscat::isFull()

{

node* temp; //isFull function

if(temp = new node)

{

delete temp;

return false;

}

else{

return true;

}

}

bool Muscat::isEmpty()

{

if (qfront==NULL) //isEmpty function

{

return true;

}

else{

return false;

}

}

void Muscat::enqueue(customerobj) //deque function

{

if(isFull())

{

cout<< "Queue is Full"; //insert into queue, enqueue function

return;

}

else

{

node* temp = new node;

// put data from object into node pointed to by temp,please create an object on this line.

if(isEmpty())

{

qFront = qRear = temp;

}

else

{

qRear->next = temp;

qRear = temp;

}

temp = NULL;

}

}

customer &Muscat::deque() //deque function.

{

if(isEmpty())

{

cout<<" Queue is Empty";

return;

}

else

{

node* temp = qFront;

qFront = qFront->next;

temp->next = NULL;

// customers object // put it on this line.

// make the customers object hold data from deleted node //put it on this line.

delete temp;

temp = NULL;

if(qFront==NULL)

{

qRear = NULL;

return obj;

}

}

}

Muscat::~Muscat() //destructor

{

deque();

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Question Who can establish a Keogh retirement plan?

Answered: 1 week ago

Question

What is Accounting?

Answered: 1 week ago

Question

Define organisation chart

Answered: 1 week ago

Question

What are the advantages of planning ?

Answered: 1 week ago

Question

Explain the factors that determine the degree of decentralisation

Answered: 1 week ago

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago