Question
Bookmark I need help for part 2 if you do part 1 that's fine but I really need help on part 2 please Make sure
Bookmark
I need help for part 2 if you do part 1 that's fine but I really need help on part 2 please
Make sure that your code contains comments explaining your code.
Use Chapter 14 as a guide to complete the following part 1 and 2 below. You can delete references to the jsjf exceptions (you may also need to modify the code as well in parts that reference it).
Part 1. Complete the implementation of the LinkedQueue class presented in this chapter. Specifically, complete the implementation of the first, isEmpty, size and toString Methods. Also create a driver class (main) to test the functionality of the methods of your program. ToString should print all the elements in the Queue.
Part 2. Complete the implementation do the CircularArrayQueue class described in chapter 14, including all methods. Also create a driver class (main) to test the functionality of the methods of your program.
package jsjf.exceptions; /** * Represents the situation in which a collection is empty. * * @author Java Foundations * @version 4.0 */ public class EmptyCollectionException extends RuntimeException { /** * Sets up this exception with an appropriate message. * @param collection the name of the collection */ public EmptyCollectionException(String collection) { super("The " + collection + " is empty."); } }
package jsjf; /** * Represents a node in a linked list. * * @author Java Foundations * @version 4.0 */ public class LinearNode{ private LinearNode next; private T element; /** * Creates an empty node. */ public LinearNode() { next = null; element = null; } /** * Creates a node storing the specified element. * @param elem element to be stored */ public LinearNode(T elem) { next = null; element = elem; } /** * Returns the node that follows this one. * @return reference to next node */ public LinearNode getNext() { return next; } /** * Sets the node that follows this one. * @param node node to follow this one */ public void setNext(LinearNode node) { next = node; } /** * Returns the element stored in this node. * @return element stored at the node */ public T getElement() { return element; } /** * Sets the element stored in this node. * @param elem element to be stored at this node */ public void setElement(T elem) { element = elem; } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started