Answered step by step
Verified Expert Solution
Question
1 Approved Answer
all pictures dont need to be modified only the copied code queue_type.h fill out the //impliments in c++ thank you queue_type.h template class queueType :
all pictures dont need to be modified only the copied code queue_type.h fill out the //impliments in c++ thank you
queue_type.h
template
class queueType : public queueADT
{
public:
queueType(int queueSize = 100) {
// implement constructor
}
~queueType() {
// implement destructor
}
bool isEmptyQueue() const {
return (count == 0);
}
bool isFullQueue() const {
return (count == maxQueueSize);
}
int getSize() const {
return count;
}
int getMaxCapacity() const {
return maxQueueSize;
}
void initializeQueue() {
// implement function
}
Type front() const {
assert(!isEmptyQueue());
return list[queueFront];
}
Type back() const {
assert(!isEmptyQueue());
return list[queueRear];
}
void enQueue(const Type& queueElement) {
// implement function
}
void deQueue() {
// implement function
}
private:
int maxQueueSize; //variable to store the maximum queue size
int count; //variable to store the number of
int queueFront; //variable to point to the first
int queueRear; //variable to point to the last
Type* list; //pointer to the array that holds
};
#endif // !QUEUE_TYPE_H
just incase main is blurry i cut it into two pictures
In this exercise you will have to simulate a queuing system. All the necessary classes are provided to you. Here is a summary of the available classes: customer Type: this class is used to create customer objects to add to the queue. It stores useful information about the customer such as customer number, arrival time, waiting time and transaction time. Code is provided and shall be used as is serverType: this class is used to create server objects. Customers go to servers to complete their transaction. Each server can serve only one customer at the time, so it is always set as either busy or free. Code for this class is provided and shall be used as is! serverListType: a list of server created at the beginning of the simulation (the number of servers is part of the parameters) serverListType keeps track of what servers are available. A very important function of serverListType is updateServers, which is used at each iteration to determine if a server has become available. Code for this class is provided and shall be used as is waiting CustomerQueueType: this class inherits from the queue Type class and adds only a method (beside the constructor). updateWaitingQueue(). This method is used to increment the waiting time of each customer in the queue. main.cpp controls the execution of the queueing system Code is provided and shall be used as is! queue Type: the queue that customers join when they first arrive queueType inherits from the abstract class queueADT, which has the only goal of stipulating the requisites of a queue class. You can look at each file for more details regarding the classes implementations and how they work The main function starts with the creation of the necessary variables for the simulation. These include a clock (a counter to simulate the passing of time), the simulation parameters (total simulation time, number of servers, transaction time, and average time between customers arrival), total waiting time total customers arrived and total customers served Additionally, you will need the queue (waitQueue). a list of servers (servers) and a customer object (customer). For more explanation, please view the short video on Queue Simulation available in Teams. Your task is to complete the array based queue implementation in queueuType h Please revisit the PDSO9Queues slides and video on array based implementations of Queues. Specifically the following items need to be added: Constructor provide the code for the queue constructor taking as an argument the maximum number of elements in the array used to manage the queue. If no parameter is provided by the user code to the constructor, the maximum queue size shall be 100. If a negative parameter is provided to the constructor, the maximum queueu size shall be 100. Destructor provide the code clean up the queue. enQueue provide the code to add an element to the queue. If the queue is full, your code is supposed to return the error message: Can not add to a full queue deQueue: provide the code to remove an element from the queue. If the queue is empty, your code is supposed to return the error message Cannot remove from an empty queue Files Nude includes cludert _ stresoucest what 34 15 10 www. 18 in me cout Dout ter ter of A series cuted out the ofron cout 2 #include "customer_type.h" int customerType: :pseudoRandom = 1; 5 6 customerType:: customerType(int id, int anytime, int wtime, int miten) 7 { 8 setCustomerInfo(id, arrviine, wine, miten); 9 } 10 void customerType::setCustomer info(int id, int arrvtine, int wtime, int mitem) 12 { customerlumber = id; arrivaltine - arrvtime; 15 waitingTime = time; maxItem - miten; if (miten -- 0) { numofitem = m; } else { pseudoRandom . (pseudorandon 3+1)% maxIten; 21 numofitem = pseudorandon + 1; // number of item is 1 to max 22 3 } int custonertype::getuaitingtine() const { return waitingtime; 28 } void customerType::setraitingtine(int tine) { waitingtime = time; } 23 24 25 26 27 35 void customertype::incrementiaitingtine() 36 { 37 waitingTime--; 38 } 39 40 int custonerType::getarrivalTime() const { return arrivaltime; 43 } int customerType: :getrunofitem() const 46 { return numofitem; 41 42 44 45 48 } se 51 52 53 int customerType::getCustomerlumbert) const { return customer Number; ) N 4 Files main.cpp customer_type.c... customer_type.h queue_type.h queueADTH server_list_type... server_list_typen server_type.cpp server_type.h update_waiting waiting custom... queue ADT.h 1 #ifndef QUEUE_ADT_H #define QUEUE_ADT_H 3 template Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started