Que main class
import java.io.*;
class que{
public static void main(String args[]) throws IOException{
// create an object to take input from user
BufferedReader br= new BufferedReader (new InputStreamReader(System.in));
// create a QueBlueprint object
QueBlueprint Quer = new QueBlueprint();
//take choices from user
int c=0;
do{
System.out.println("1 : to print elements in queue");
System.out.println("2 : Current Status");
System.out.println("3 : To Add Element (Push)");
System.out.println("4 : To Remove Element (Pop)");
System.out.println("5 : Exit");
System.out.println("\n Enter Your Choice");
c=Integer.parseInt(br.readLine());
if(c==1){
Quer.printQueue();
}
if(c==2){
Quer.currentStatus();
}
if(c==3){
Quer.push();
}
if(c==4){
Quer.pop();
}
}
while(c!=5);
}
}
Queue main logic
import java.io.*;
class QueBlueprint{
// declare some global variables
int currentPosition= -1;
int size= 20;
int arr[]= new int[size];
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
//method to check if queue is full
protected boolean full(){
if(currentPosition==(size-1)){
System.out.println("Queue is Full");
return true;
}
else{
return false;
}
}
// method to check if queue is empty
protected boolean empty(){
if(currentPosition != -1){
return false;
}
else{
System.out.println("Queue is Empty");
return true;
}
}
// method to print the queue
void printQueue(){
if(!full() && !empty()){
for(int i=0;i0){
for(int i=0;i