I fixed it.. Just had to call the methods for the Deque class and set the deque in the Deque class to public and the make queue array equal to the deque array
class Deque {
public Object[] deque;
private final int MAX_SIZE = 5;
private int size;
public Deque() {
deque = new Object[MAX_SIZE];
size = 0;
}
public void insertOnFront(Object item) {
if (isEmpty()) {
deque[0] = item;
size++;
}
else {
Object[] temp;
if (size == deque.length) {
temp = new Object[size * 2];
temp[0] = item;
for (int i = 0; i < size; i++) {
temp[i + 1] = deque[i];
}
}
else {
temp = new Object[deque.length];
temp[0] = item;
for (int i = 0; i < size; i++) {
temp[i + 1] = deque[i];
}
}
deque = temp;
size++;
}
}
public Object deleteFromFront() {
Object itemDeleted;
if (isEmpty()) {
itemDeleted = null;
}
else {
itemDeleted = deque[0];
for (int i = 0; i < size; i++) {
deque[i] = deque[i + 1];
}
size--;
}
return itemDeleted;
}
public void insertOnBack(Object item) {
if (isEmpty()) {
deque[0] = item;
size++;
}
else {
Object[] temp;
if (size == deque.length) {
temp = new Object[size * 2];
for (int i = 0; i < size; i++) {
temp[i] = deque[i];
}
temp[size] = item;
}
else {
temp = new Object[deque.length];
for (int i = 0; i < size; i++) {
temp[i] = deque[i];
}
temp[size] = item;
}
deque = temp;
size++;
}
}
public Object deleteFromBack() {
Object itemDeleted;
if (isEmpty()) {
itemDeleted = null;
}
else {
itemDeleted = deque[size - 1];
deque[size - 1] = null;
size--;
}
return itemDeleted;
}
private boolean isEmpty() {
return (size == 0);
}
public String toString() {
String s = null;
for (int i = 0; i < size; i++) {
s = deque[i] + "\n";
}
return s;
}
public void toStore() {
}
}
class Queue extends Deque{
Object[] queue;
int front, rear, count;
private final int MAX_SIZE = 5;
public Queue() {
queue = new Object[MAX_SIZE];
front = 0;
rear = 0;
count = 0;
}
public void insert(Object item) {
Object[] temp;
if (count == queue.length) {
temp = new Object[queue.length * 2];
for (int i = 0; i < count; i++) {
temp[i] = queue[front];
front = (front + 1) % queue.length;
}
front = 0;
rear = count;
queue = temp;
}
insertOnBack(item);
queue[rear] = deque[count];
rear = (rear + 1) % queue.length;
count++;
}
public Object delete() {
if (isEmpty()) {
return null;
}
else {
Object result = queue[front];
queue[front] = null;
deleteFromFront();
front = (front + 1) % queue.length;
count--;
return result;
}
}
public boolean isEmpty() {
return (count == 0);
}
public String toString() {
String result = "";
int scan = 0;
while (scan < count) {
if (queue[scan] != null) {
result += queue[scan].toString() + "/n";
}
scan++;
}
return result;
}
}