Imagine that we have developed a Queue to hold double values
Solution
1)
class arrayQueue{
protected int Queue[] ;
protected int front, rear, size, len;
/* Constructor */
public arrayQueue(int n)
{
size = n;
len = 0;
Queue = new int[size];
front = -1;
rear = -1;
}
}
2)
class arrayQueue{
 protected int Queue[] ;
 protected int front, rear, size, len;
 /* Constructor */
 public arrayQueue(int n) {
 size = n;
 len = 0;
 Queue = new int[size];
 front = -1;
 rear = -1;
 }
/* Function to insert an element to the queue */
 public void insert(int i) {
 if (rear == -1) {
 front = 0;
 rear = 0;
 Queue[rear] = i;
 }
 else if (rear + 1 >= size)
 throw new IndexOutOfBoundsException(\"Overflow Exception\");
 else if ( rear + 1 < size)
 Queue[++rear] = i;
 len++ ;
 }   
}
public class QueueImplement{
 public static void main(String[] args){
 /* creating object of class arrayQueue */
 arrayQueue q = new arrayQueue(n);
q.insert(0.3 );
q.insert(0.5);
}
}
3)
class arrayQueue{
 protected int Queue[] ;
 protected int front, rear, size, len;
 /* Constructor */
 public arrayQueue(int n) {
 size = n;
 len = 0;
 Queue = new int[size];
 front = -1;
 rear = -1;
 }
/* Function to insert an element to the queue */
 public void insert(int i) {
 if (rear == -1) {
 front = 0;
 rear = 0;
 Queue[rear] = i;
 }
 else if (rear + 1 >= size)
 throw new IndexOutOfBoundsException(\"Overflow Exception\");
 else if ( rear + 1 < size)
 Queue[++rear] = i;
 len++ ;
 }   
}
public class QueueImplement{
 public static void main(String[] args){
 /* creating object of class arrayQueue */
 arrayQueue q = new arrayQueue(n);
q.insert(8.72);
q.insert(14.2);
q.insert(-8.13);
q.insert(22.41 );
}
}


