Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java please I need only the ans and the comments on the code please dont bring any copy from another ans from chegg Add code

java
please I need only the ans and the comments on the code
please dont bring any copy from another ans from chegg
image text in transcribed
image text in transcribed
image text in transcribed
Add code to the Queue code posted to implement circular and priority queue. Add your comments based on the assumptions you have made. Submit the code in word document. public class Queue \& int capacity /llamount of data int size,//size is current number of elements in queue int] data; int front, / /first element in queve in order and used only for delete int rear,/l last index of array Queue(int max) \{ capacity=max; data=new intimax]; front =0; rear =1;// rear =0; size =0; \} Iladd, remove, read void addData(int val)//add data to queue is call enqueue f llalways check if queue has space or not if(size0)//checking if queue is empty or not \{ size-: retum data[front++]; 1 else \{ System out printin("Queue is empty"); return - 1.//queue can only hold positive values \} int rear,// last index of array Queue(int max) I capacity=max, data=new int[max]; front =0; rear =1;// rear =0; size =0, ) lladd, remove, read void addData(int val)//add data to queue is call enqueve f I/always check if queue has space or not if(size>0)// checking if queue is empty or not \{ size-: return data[front ++1 : \} else \{ System. out. printin("Queve is empty"); return -1://queue can only hold positive values ) 3 I/read the data 3

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions