Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
image text in transcribed
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

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

Step: 3

blur-text-image

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

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

What is meant by 'Wealth Maximization ' ?

Answered: 1 week ago