Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.2k views
in Computer by (49.9k points)
closed by

A queue is an entity which can hold a maximum of 100 integers. 

The queue enables the user to add integers from the rear and remove integers from the front. 

Define a class Queue with the following details: 

Class name: Queue 

Data members/instance variables: 

Que[]: array to hold the integer elements 

size: stores the size of the array f

ront: to point the index of the front 

rear: to point the index of the rear 

Member functions: 

Queue(int mm): constructor to initialize the data size = mm, front = 0, rear = 0 

void addele(int v): to add integer from the rear if possible else display the message “Overflow” 

int delele(): returns elements from front if present, otherwise displays the message “Underflow” and return-9999 

void display(): displays the array elements Specify the class Queue giving details of ONLY the functions void addele(int) and int delete() 

Assume that the other functions have been defined. 

The main function and algorithm need NOT be written.

1 Answer

+1 vote
by (48.9k points)
selected by
 
Best answer

void addele(int v) { 

iffrear == Que.length-1) { 

System.out.println("Overflow"); 

else { 

Que[rear ++] = v; 

}

int delele() { 

if(front == 0) { 

System.out.println("Underflow"); 

return-9999; 

else { 

return Que[front--]; 

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...