Question: TASK : a- Complete Queue class that Used circular array to implemented Queue b- Trace the main cade and fill the table class Queue &

 TASK : a- Complete Queue class that Used circular array to
implemented Queue b- Trace the main cade and fill the table class
Queue \& private int maxSize; private int front; // index at front

TASK : a- Complete Queue class that Used circular array to implemented Queue b- Trace the main cade and fill the table class Queue \& private int maxSize; private int front; // index at front private int back; // index at rear queue private int count; private int items[size];//store item in Q //Constructor - create Q public Queue( int s) \{ maxSize=s; items = new char[maxSize ]; front = back = count = ) II check Q empty public boolean isEmpty() \{ return ) I/ check Q full public boolean isfull() \{ return //insert into Q public void enQueue (char j) // put item at rear of queue \& if (. System.out.print("Cannot insert. Queue is full! "); else \{ //insert at back \} // end else if > //remove item from Q public void deQueue() \{ if (.) System.out.print("Cannot remove item. Empty Queue!"); else {// retrieve item at front \}// end else if 3// end else if 3 public char peekFront() I/ get item at Front \{return items[front] ; \} public char peekRear() // get item at Back \{return items[back]:\} // Driver code TO TEST class Main \{ public static void main(String args[]) \{ Queue q= new Queue (5); ' 1 q.enQueue(14); //2 q.enQueue(22); //3 q.enQueue(13); //4 q.enQueue(-6); ///5 q.deQueue(); 1/6 q.deQueue(;://7 q.enQueue(9); 1/8 q.enQueue(20); //9 q.enQueue(5): //10 q.enQueue(17); //11 \} 3 Statement Front back count Circular outpet Gesue (5): a momernastak Statement Froat back couat Circelar wespet qmoverting q.enQueuc(20); qenQuene

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!