Question
Would like to know why im getting the following error and how to fix it class Queue //Queue class begins----CASHIER!!!!????? { private: Node*front; Node*rear; int
Would like to know why im getting the following error and how to fix it
class Queue //Queue class begins----CASHIER!!!!?????
{
private:
Node*front;
Node*rear;
int count;//counter
int timer;//minutes in use
char status;//'a'=available,'i'=inactive
int timelimit;//depends on customer service_time????
int in_line;
public:
Queue();//default constructor
void enqueue(int element);//adds a node to the end of a list
int dequeue();//removes a node from the front of the queue
int get_front(void);//??Returns item at the front of the queue
bool empty(void);//returns true if queue is empty
void inc_timer();//minutes in use
int get_timer();//returns timer
char get_status();//'a'=available,'i'=inactive
int get_inline();
int get_timelimit();
void add_customer(int service_time);
};
Queue::Queue()
{ timer=0;
status=0;
in_line=0;
front=NULL;
rear=NULL;
count=0;
}
char Queue::get_status()//returns status of queue??
{
return status;
}
void Queue::inc_timer()//increase timer
{
timer++;
}
int Queue::get_timer()//return time??
{
return timer;
}
void Queue::enqueue(int element)//adds to the rear
{
Node*ptr=new Node();
ptr->set_data(element);
//ptr->getdata=element;
//ptr->get_next=NULL;
if (front==NULL)
{
front=rear=ptr;
}
else
{
rear->setnext(ptr);//?
rear=ptr;
}count++;
}
int Queue::dequeue()//removes node from front
{
if(front!=NULL)
{
Node*ptr=front;
delete front;
front=ptr->get_next();
}
if(front==NULL)
{ rear=NULL;
count=count-1;//??
return true;
}else
return false;
}
int Queue::get_front(void)///???
{ if(front!=NULL)
{
return front->getdata();
cout
}
else
return 0;
}
bool Queue::empty(void)//determines if queue is empty
{
if((count=0)||(front==NULL))
return true;
else
return false;
}
int Queue::get_inline()
{
return in_line;
}
int Queue::get_timelimit()
{
return timelimit;
}
void Queue::add_customer(int service_time)
{
if(timelimit=NULL)
{
timer=0;
}
get_timelimit.dequeue(service_time); //***error is here*****
}
1 error C2228: left of'.dequeue' must have class/struct/union project1.cppStep 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