Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement Stack or Queue ADT using linked nodes implementation. Full scale appli

ID: 3647051 • Letter: I

Question

Implement Stack or Queue ADT using linked nodes implementation.

Full scale application with special test driver and a test plan. Project is based on the usage of dynamically allocated memory and linked structures.

Project includes Application to use ADT, ADT itself, Node class to store Itemtype data, and a simple Test Driver to run test data.

I need Complete java program

Implement the same unit test functionality as in the Project 3 with mandatory components:
1. input data file and output file for test driver input
2. full unit test functionality should include cases that may throw exceptions.
3. try and catch have to be included into the program.

Explanation / Answer

program " public class StackOfInts { // (alternate version, using an array) private int[] items = new int[10]; // Holds the items on the stack. private int top = 0; // The number of items currently on the stack. /** * Add N to the top of the stack. */ public void push( int N ) { if (top == items.length) { // The array is full, so make a new, larger array and // copy the current stack items into it. int[] newArray = new int[ 2*items.length ]; System.arraycopy(items, 0, newArray, 0, items.length); items = newArray; } items[top] = N; // Put N in next available spot. top++; // Number of items goes up by one. } /** * Remove the top item from the stack, and return it. * Throws an IllegalStateException if the stack is empty when * this method is called. */ public int pop() { if ( top == 0 ) throw new IllegalStateException("Can't pop from an empty stack."); int topItem = items[top - 1] // Top item in the stack. top--; // Number of items on the stack goes down by one. return topItem; } /** * Returns true if the stack is empty. Returns false * if there are one or more items on the stack. */ public boolean isEmpty() { return (top == 0); } } // end class StackOfInts "

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote