I have this code 

public class ArrayQueue implements Queue {
     //fields to represent our stack in an array
    
    //the array of items
    private Object[] items;
    
    //maximum capacity
    private int maximum;
    
    //pointer to the position of the front of the queue
    //this points to 0 when the stack is empty
    private int front;
    
    //Actual number of items in the queue
    private int size;
    
    //Constructor
    public ArrayQueue(){
        //set the capacity to 20
        maximum = 20;
        
        //create the array
        items = new Object[maximum];
        
        //set the front to 0 as the stack is empty
        front = 0;
        
        //set the size to 0
        size = 0;
    }
            

    @Override
    public Object dequeue() {
        // first check if the queue is empty. 
        // If it is, print an error message and return null,
        // otherwise return the item at the front,
        // decrement the size and increment the front pointer.
        if (isEmpty()) {
            System.out.println("Stack Empty");
            return null;
        } else {
            Object answer = items[front];
            front = (front + 1) % maximum;
            size--;
            return answer;
        }
    }

    @Override
    public void enqueue(Object o) {
        // first check if the queue is full.
        // If it is, print an error message,
        // else calculate the position of the back of the queue
        // and put the item in the back, 
        // and finally increment the size
        if (size == maximum){
           System.out.println("Queue full");
        } else {
            int back = (front + size) % maximum;
            items[back] = o;
            size++;
        }
    }

    @Override
    public boolean isEmpty() {
        //use the size!
        return (size==0);
    }

    @Override
    public int size() {
        //use the size!
        return size;
    }

    @Override
    public Object front() {
        // First check if the queue is empty.
        // If it is, print an error message and return null,
        // otherwise return the item at the front.
        
        if (isEmpty()) {
            System.out.println("Stack Empty");
            return null;
        } else {
            return items[front];
        }
    }
}

public class ArrayStack implements Stack {
    //fields to represent our stack in an array
    
    //the array of items
    private Object[] items;
    
    //maximum capacity
    private int maximum;
    
    //pointer to the position of the top of the stack
    //this points to -1 when the stack is empty
    private int top;
    
    public ArrayStack(){
        //set the capacity to 20
        maximum = 20;
        
        //create the array
        items = new Object[maximum];
        
        //set the top to -1 as the stack is empty
        top = -1;
    }

    @Override
    public Object pop() {
        // First check if the stack is empty.
        // If it is, print an error message and return null,
        // otherwise, return the item the top is pointing to 
        // and decrement the top pointer
        if (isEmpty()) {
            System.out.println("Stack Empty");
            return null;
        } else {
            Object answer = items[top];
            top--;
            return answer;
        }
    }

    @Override
    public void push(Object o) {
        // First check if the array is full.
        // If it is, print an error message,
        // else increment the top and put the item in that space
        if (top == (maximum - 1)){
           System.out.println("Stack full");
        } else {
            top++;
            items[top] = o;
        }
    }

    @Override
    public boolean isEmpty() {
        // The stack is empty if the top is pointing to -1
        return (top == -1);
    }

    @Override
    public int size() {
        // The size of the stack can be calculated using the position of top
        return(top + 1);
    }

    @Override
    public Object top() {
        // First check if the stack is empty. 
        // If it is, print an error message and return null,
        // otherwise, return the item the top is pointing to. 
        if (isEmpty()) {
            System.out.println("Stack Empty");
            return null;
        } else {
            return items[top];
        }
    }
}

import java.util.ArrayList;

public class DiGraph
{
    protected int numberOfNodes;
    protected ArrayList<Integer>[] adjacencyList;

    /**
     * Constructor for a directed graphs with a number of nodes but no edges.
     * @param nodes the number of nodes in the graph
     */
    public DiGraph(int nodes) {
        //initialise the number of nodes
        numberOfNodes = nodes;
        //make the array of ArrayLists
        adjacencyList = new ArrayList [nodes];
        //go through each node and make a new ArrayList for that node
        for (int i = 0; i < nodes; i++) {
            adjacencyList[i] = new ArrayList<Integer>();
        }
    }

    /**
     * Add an edge between the two nodes given
     * @param fromNode the node the edge starts from
     * @param toNode the node that the edge goes to
     */
    public void addEdge(int fromNode, int toNode){
        adjacencyList[fromNode].add(toNode);
    }

    /**
     * Return the number of nodes in the graph
     * @return the number of nodes in the graph
     */
    public int getNumberOfNodes() {return numberOfNodes; }

    /**
     * Determine whether there is an edge between the two nodes given
     * @param fromNode the node the edge starts from
     * @param toNode the node that the edge goes to
     * @return true if there is an edge between fromNode and toNode, false otherwise
     */
    public boolean hasEdge(int fromNode, int toNode) {return adjacencyList[fromNode].contains(toNode); }

    /**
     * Print the adjacency list representation of the graph
     */
    public void printAdjacencyList(){
        System.out.println("Number of nodes = "+ numberOfNodes);
        for (int i = 0; i< adjacencyList.length; i++){
            System.out.print("Neighbours of " + i + " : ");
            for (Integer neighbour: adjacencyList[i]) {
                System.out.print(neighbour + " ");
            }
            System.out.println();
        }
    }
}

public class Main {
    public static final String DASHES = new String(new char[80]).replace("\0", "-");
    /**
     * COMPLETE THIS METHOD to create the graph structure shown in the project brief
     * @param socialNetwork stores the graph structure
     */
    private static void buildGraph(SocialNetwork socialNetwork) {
        int[][] edges = {
                {Names.ABEL, Names.CATO},
                {Names.BINA, Names.ABEL},
                {Names.CATO, Names.ABEL},
                {Names.DANA, Names.BINA},
                {Names.DANA, Names.CATO},
                {Names.DANA, Names.FERN},
                {Names.DANA, Names.GENO},
                {Names.EDEN, Names.CATO},
                {Names.EDEN, Names.DANA},
                {Names.EDEN, Names.FERN},
                {Names.EDEN, Names.JODY},
                {Names.FERN, Names.DANA},
                {Names.GENO, Names.FERN},
                {Names.GENO, Names.INEZ},
                {Names.HEDY, Names.FERN},
                {Names.HEDY, Names.JODY},
                {Names.INEZ, Names.GENO},
                {Names.JODY, Names.INEZ}
        };

        for (int[] edge : edges) {
            socialNetwork.addEdge(edge[0], edge[1]);
        }
    }

    /**
     * Full test for the broadcastTo method
     * @param theSocialNetwork stores the graph structure
     */
    private static void testBroadCastTo(SocialNetwork theSocialNetwork) {
        System.out.println(DASHES);
        System.out.println("broadcastTo test\n");
        for (int i = 0; i < Names.networkMembers.length; i++) {
            System.out.print("Followers of " + Names.networkMembers[i] + ": ");
            System.out.println(theSocialNetwork.broadcastsTo(Names.networkMembers[i]));
        }
        System.out.println();
    }
    /**
     * Full test for the canReach method
     * @param theSocialNetwork stores the graph structure
     */
    private static void canReachTest(SocialNetwork theSocialNetwork) {
        System.out.println(DASHES);
        System.out.println("canReach test\n");
        StringBuilder canReach = new StringBuilder();
        for (int i = 0; i < Names.networkMembers.length; i++) {
            for (int j = 0; j < Names.networkMembers.length; j++) {
                if (j != i && theSocialNetwork.canReach(Names.networkMembers[i], Names.networkMembers[j])) {
                    canReach.append(Names.networkMembers[j]).append(" ");
                }
            }
            if (canReach.length() == 0) {
                canReach = new StringBuilder(" no one!");
            }
            System.out.println(Names.networkMembers[i] + " can reach " + canReach);
            canReach = new StringBuilder();
        }
    }
    /**
     * Full test for the receiversOf method
     * @param theSocialNetwork stores the graph structure
     */
    private static void receiversOfTest(SocialNetwork theSocialNetwork) {
        System.out.println(DASHES);
        System.out.println("receiversOf test\n");
        for (int i = 0; i < Names.networkMembers.length; i++) {
            System.out.print("Receivers of " + Names.networkMembers[i] + ": ");
            System.out.println(theSocialNetwork.receiversOf(Names.networkMembers[i]));
        }
        System.out.println();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        SocialNetwork theSocialNetwork = new SocialNetwork();
        buildGraph(theSocialNetwork);
        testBroadCastTo(theSocialNetwork);

        canReachTest(theSocialNetwork);

        receiversOfTest(theSocialNetwork);
    }




}

public class Names {
    public static final int ABEL = 0;
    public static final int BINA = 1;
    public static final int CATO = 2;
    public static final int DANA = 3;
    public static final int EDEN = 4;
    public static final int FERN = 5;
    public static final int GENO = 6;
    public static final int HEDY = 7;
    public static final int INEZ = 8;
    public static final int JODY = 9;
    public static final String [] networkMembers = {
        "Abel",
        "Bina",
        "Cato",
        "Dana",
        "Eden",
        "Fern",
        "Geno",
        "Hedy",
        "Inez",
        "Jodi"
    };
}

public interface Queue {
    /**
     * Removes and returns the item at the front of the queue
     * @return the item at the front the queue 
     */
    public Object dequeue();
    
    /**
     * Inserts an object to the back of the queue
     * @param o the object to be pushed
     */
    public void enqueue(Object o);
    
    
    /**
     * Tells us if the queue is empty
     * @return true if the queue is empty
     */
    public boolean isEmpty();
    
    /**
     * Returns the number of items in the queue
     * @return the number of items in the queue
     */
    public int size();
    
    /**
     * Tells us the item at the front without removing it
     * @return the object at the front of the queue 
     */
    public Object front();
}

import java.util.ArrayList;
import java.util.Arrays;

public class SocialNetwork extends DiGraph {

    public SocialNetwork() {
        super(Names.networkMembers.length);
    }

    public ArrayList<String> broadcastsTo(String person) {
        int index = Arrays.asList(Names.networkMembers).indexOf(person);
        ArrayList<String> followers = new ArrayList<>();
        for (Integer node : adjacencyList[index]) {
            followers.add(Names.networkMembers[node]);
        }
        return followers;
    }

    public boolean canReach(String source, String target) {
        int sourceIndex = Arrays.asList(Names.networkMembers).indexOf(source);
        int targetIndex = Arrays.asList(Names.networkMembers).indexOf(target);
        return Traversal.DFS(adjacencyList, sourceIndex, targetIndex);
    }

    public ArrayList<String> receiversOf(String person) {
        int index = Arrays.asList(Names.networkMembers).indexOf(person);
        ArrayList<Integer> nodeIndexes = Traversal.BFS(adjacencyList, index);
        ArrayList<String> receivers = new ArrayList<>();
        for (Integer node : nodeIndexes) {
            receivers.add(Names.networkMembers[node]);
        }
        return receivers;
    }
}

public interface Stack {
    /**
     * Removes and returns the item at the top of the stack
     * @return the item at the top the stack
     */
    public Object pop();
    
    /**
     * Inserts an object to the top of the stack
     * @param o the object to be pushed
     */
    public void push(Object o);
    
    /**
     * Tells us if the stack is empty
     * @return true if the stack is empty
     */
    public boolean isEmpty();
    
    /**
     * Returns the number of items in the stack
     * @return the number of items in the stack
     */
    public int size();
    
    /**
     * Tells us the item at the top without removing it
     * @return the object at the top of the stack
     */
    public Object top();
}

import java.util.ArrayList;
public class Traversal {

    public static boolean DFS(ArrayList<Integer>[] adjList, Integer startNode, Integer destinationNode) {
        boolean[] visited = new boolean[adjList.length];
        return DFSUtil(adjList, startNode, destinationNode, visited);
    }

    private static boolean DFSUtil(ArrayList<Integer>[] adjList, Integer currentNode, Integer destinationNode, boolean[] visited) {
        visited[currentNode] = true;

        if (currentNode.equals(destinationNode)) {
            return true;
        }

        for (Integer adjNode : adjList[currentNode]) {
            if (!visited[adjNode]) {
                if (DFSUtil(adjList, adjNode, destinationNode, visited)) {
                    return true;
                }
            }
        }
        return false;
    }

    public static ArrayList<Integer> BFS(ArrayList<Integer>[] adjList, Integer startNode) {
        boolean[] visited = new boolean[adjList.length];
        visited[startNode] = true;

        ArrayList<Integer> q = new ArrayList<>();
        ArrayList<Integer> visitedNodes = new ArrayList<>();
        q.add(startNode);
        visitedNodes.add(startNode);

        while (!q.isEmpty()) {
            Integer currentNode = q.remove(0);
            for (Integer adjNode : adjList[currentNode]) {
                if (!visited[adjNode]) {
                    visited[adjNode] = true;
                    q.add(adjNode);
                    visitedNodes.add(adjNode);
                }
            }
        }
        return visitedNodes;
    }
}