I already have the coding in C programming. But I think, function to calculate average waiting time doesn't working. And this coding doesn't work to give the Platinum customer priority. I hope you can...








I already have the coding in C programming. But I think, function to calculate average waiting time doesn't working. And this coding doesn't work to give the Platinum customer priority. I hope you can give me new coding or fix this coding thank you.


#include
#include
#include
#include


struct Queue // circular queue struct
{
int size;
int front;
int rear;
int *time_arr;
};


int isEmpty(struct Queue *q) // function to check is queue is empty
{
if (q->rear == q->front)
{
return 1;
}
return 0;
}


void enqueue(struct Queue *q, int time) // funntion to enqueue elements into the queue
{


q->rear = (q->rear + 1) % q->size;
q->time_arr[q->rear] = time;
}


int dequeue(struct Queue *q) // funciton to dequeue elements from queue
{
int a = -1;


q->front = (q->front + 1) % q->size;
a = q->time_arr[q->front];
}


int main()
{
// creating queue instances for gold and platinum customers
struct Queue gold_customer;
struct Queue platinum_customer;


// fixing size of queue as 10 , although user can change as per requirement
gold_customer.size = 10;
platinum_customer.size = 10;


// setting front and rear position of queue
gold_customer.front = gold_customer.rear = 0;
platinum_customer.rear = 0;
platinum_customer.front = 0;


// dynamically allocating the queue array space
gold_customer.time_arr = (int *)malloc(gold_customer.size * sizeof(int));
platinum_customer.time_arr = (int *)malloc(platinum_customer.size * sizeof(int));


printf("Enter total number of customers : \n");
int n;
scanf("%d", &n);
for (int i = 0; i < n;="">
{
printf("Select the type of customer you are : \n1.Gold 2.Platinum\n\n");
int x;
scanf("%d", &x);


int random;


if (x == 1)


{


random = rand() % 30;
enqueue(&gold_customer, random);
printf("Your expected waiting time is %dS. Thankyou for your patience. \n\n", random);
}


if (x == 2)


{
random = rand() % 30;
enqueue(&platinum_customer, random);
printf("Your expected waiting time is %dS. Thankyou for your patience. \n\n", random);
}
}
printf("\n\n");
while (isEmpty(&platinum_customer) == 0)


{


printf("Platinum customer with time expected %ds is served. \n", dequeue(&platinum_customer));
}


while (isEmpty(&gold_customer) == 0)


{
printf("Gold customer with time expected %ds is served. \n", dequeue(&gold_customer));
}


return 0;
}









.



Task 1: Application of scheduling process in a phone answering system.<br>System Details: -<br>Tell Tone Sdn. Bhd. is a telecommunication company that has a phone answering system for its customer<br>service centre. Whenever customers call the customer service center, they will be put in a queue before<br>they are being served by the customer service representative. If the operators are busy, the customers<br>are asked to wait and given a certain number. The time that a customer has to wait could be as short as a<br>minute or as long as 30 minutes. This also depends on the types of customer. Platinum customer will be<br>given a higher priority compared to a Gold customer. Thus, when a call from a Platinum customer came,<br>it will be processed first. If there are no Platinum customer left in the queue, the system will serve the<br>Gold customer.<br>Demonstrate the scheduling process of a switch in a phone answering system by using queue.<br>Construct a program to demonstrate the problem.<br>Calculate the average waiting time for each call.<br>

Extracted text: Task 1: Application of scheduling process in a phone answering system. System Details: - Tell Tone Sdn. Bhd. is a telecommunication company that has a phone answering system for its customer service centre. Whenever customers call the customer service center, they will be put in a queue before they are being served by the customer service representative. If the operators are busy, the customers are asked to wait and given a certain number. The time that a customer has to wait could be as short as a minute or as long as 30 minutes. This also depends on the types of customer. Platinum customer will be given a higher priority compared to a Gold customer. Thus, when a call from a Platinum customer came, it will be processed first. If there are no Platinum customer left in the queue, the system will serve the Gold customer. Demonstrate the scheduling process of a switch in a phone answering system by using queue. Construct a program to demonstrate the problem. Calculate the average waiting time for each call.
Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here