import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class QueueArray {
static class Queuearray{
int size = 10;
int[] arrayQueue = new int[size];
int front = -1;
int end = -1;
public void add(int d){
if(front >= size){
System.out.println("queue is full");
}
else{
end++;
arrayQueue[end] = d;
}
}
public int deQueue(){
if(front == end){
System.out.println("empty");
}
int temp;
front++;
temp = arrayQueue[front] ;
return temp;
}
public void print(){
for(int i = front+1; i<end+1;i++){
System.out.println("[" + arrayQueue[i] + "]");
}
}
}
public static void main(String[] args)throws IOException {
// TODO code application logic here
int Select;
Queuearray QueueArray = new Queuearray();
int i;
int Value;
do{
System.out.println("1.Input a queue data");
System.out.println("2.Output a queue data");
System.out.println("3.Exit");
System.out.print("please select one=>");
//
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String str = br.readLine();
Select=Integer.parseInt(str);
//
switch(Select){
case 1:
System.out.print("Please input the data=>");
BufferedReader br2=new BufferedReader(new InputStreamReader(System.in));
String str2 = br2.readLine();
Value = Integer.parseInt(str2);
QueueArray.add(Value);
QueueArray.print();
System.out.println("");
break;
case 2:
Value =QueueArray.deQueue();
QueueArray.print();
System.out.println("");
break;
}
}while(Select !=3);
}
}