
USE the Node, StackArray, StackRef and Stack interface classes PROVIDED BELOW to create code that reads input from the sample Data File PROVIDED to solve
PLEASE READ DIRECTIONs VERY CAREFULLY
please answer in full here and thanks for your help
Data File
2 3 4 + +
12 6 / 4 * 4 +
2 2 3 3 * * *
7 5 / 5 + 17 -
4 3 - 5 6 + 4 * -
1 1 + 3 * 4 - 10 ^
public class Node <T>
{
private T data;
private Node<T> next;
public Node(T data, Node<T> next)
{
this.data = data;
this.next = next;
}
public T getData()
{
return data;
}
public Node<T> getNext()
{
return next;
}
}
import java.util.Stack;
public class StackArray<T> implements Stack<T> {
private T [] elements;
private int top;
private int size;
public StackArray (int size)
{
elements = (T[]) new Object[size];
top = -1;
this.size = size;
}
public boolean empty()
{
return top == -1;
}
public boolean full()
{
return top == size - 1;
}
public boolean push(T el)
{
if (full())
return false;
else
{
top++;
elements[top] = el;
return true;
}
}
public T pop()
{
T el = elements[top];
top--;
return el;
}
}
// Generic Stack Reference Implementation
public class StackRef<T> implements Stack<T>
{
private Node<T> top;
public StackRef (int size)
{
top = null;
}
public StackRef()
{
top = null;
}
public boolean empty()
{
return top == null;
}
public boolean full()
{
return false;
}
public boolean push(T el)
{
Node<T> node = new Node<>(el, top);
top = node;
return true;
}
public T pop()
{
if (empty())
return null;
T el = top.getData();
top = top.getNext();
return el;
}
}
// Generic Stack Interface
public interface Stack<T>
{
public boolean empty();
public boolean full();
public boolean push(T el);
public T pop();
}
import java.util.Scanner;
import java.util.Stack;
import java.util.Set;
import java.io.*;
import java.util.*;
public class RPN {
private static Stack<String> stack;
private static FileReader file;
private static Scanner in;
private static Set<String> operators;
}



It is defined as a powerful general-purpose programming language. It is used to develop desktop and mobile
applications, big data processing, embedded systems.
A simple java program example :
class Simple
{
public static void main(String args[]){
System.out.println("Good Morning");
}
}
Data types of java are divided into two groups :
(i) Primitive data types : It includes byte, short, int, long, float, double, boolean and char.
(ii) Non-primitive data types : It includes strings, arrays and classes.
Step by stepSolved in 2 steps

- QueueArray.java This file implements QueueInterface.java This file has * attributes of an array holding queue elements. An integer represents front * index, an integer for rear index, and an integer to keep track number of * elements in the queue. An overloaded constructor accepts an integer for * initializing the queue size, e.g. array size. An enqueue method receives an * object and place the object into the queue. The enqueue method will throw * exception with message "Overflow" when the queue is full. A dequeue method * returns and removes an object from front of the queue. The dequeue method * will throw exception with message "Underflow" when the queue is empty. A size * method returns number of elements in the queue. A toString method returns a * String showing size and all elements in the queue.arrow_forwardstruct insert_at_back_of_sll { // Function takes a constant Book as a parameter, inserts that book at the // back of a singly linked list, and returns nothing. void operator()(const Book& book) { /// TO-DO (3) /// // Write the lines of code to insert "book" at the back of "my_sll". Since // the SLL has no size() function and no tail pointer, you must walk the // list looking for the last node. // // HINT: Do not attempt to insert after "my_sll.end()". // ///// END-T0-DO (3) ||||// } std::forward_list& my_sll; };arrow_forwardIt is python language Write the code that creates a new Node class. It will store data and next attributes. You only need to create the __init__ method. data and next variables will have default values, both set to None. Assume you are using the Node class from the previous connection to create a LinkedList. You have the code below, create a method that removes the first node from the LinkedList. class LinkedList: def __init__(self): self.head = None Based on the code from the last two questions, create a new LinkedList. Add 2 values to the LinkedList (there is an add method that accepts data as an argument, called add). Then call the removeFront method created in the previous question. Based on the previous questions, create a Queue class that uses the LinkedList for its data storage. Create the __init__, isEmpty, insert, remove, and size methods. Assume that LinkedList class has the add, removeFront and size methods defined. Based on the LinkedList code already…arrow_forward
- maxLength Language/Type: Related Links: Java Set collections Set Write a method maxLength that accepts as a parameter a Set of strings, and that returns the length of the longest string in the set. If your method is passed an empty set, it should return 0. 1 9 10 Method: Write a Java method as described, not a complete program or class. N345678 2arrow_forwardData Structures/Algorithms in Javaarrow_forward* QueueArrayList.java This file implements QueueInterface.java This file has * only one ArrayList<T> type of attribute to hold queue elements. One default * constructor initializes the ArrayList<T> queue. An enqueue method receives an * object and place the object into the queue. The enqueue method does not throw * overflow exception. A dequeue method returns and removes an object from queue * front. The dequeue method will throw exception with message "Underflow" when * the queue is empty. A size method returns number of elements in the queue. A * toString method returns a String showing size and all elements in the queue. Please help me in javaarrow_forward
- In C++.arrow_forwardT LO Assume that the nodeType defined as the following struct nodeType int info; nodetype * link; node Type "List, "first, "current; *"last, "p, "temp; List 11 34 000 - 100 →NULL 47 99 4. 2. d. last first current Write C++ code to delete the last node of the list and also deallocate the memory occupied by this node. After deleting the node make last point to the last node of the list and the link of the last node must be nullptr. You can declare additional pointer variable if it is needed. Click Save and Submit to saue and submit. Click Save All Ansuers to save all answers. Save and Submit English (United States) Focus 168% sp 目 tv 15 D0O 000 F4 F3 F5 F7 F8 F11 %24 5. 9 4.arrow_forwardLab 19 Building a linked list Start this lab with the code listed below. The LinkedList class defines the rudiments of the code needed to build a linked list of Node objects. You will first complete the code for its addFirst method. This method is passed an object that is to be added to the beginning of the list. Write code that links the passed object to the list by completing the following tasks in order: 1. Create a new Node object. 2. Make the data variable in the new Node object reference the object that was passed to addELKEt, 3. Make the next variable in the new Node object reference the object that is currently referenced in variable first. 4, Make variable first reference the new Node. Test your code by running the main method in the LinkedLiatBunner class below. Explain, step by step, why each of the above operations is necessary. Why are the string objects in the reverse order from the way they were added? public class LinkedList private Node first; public LinkedList () {…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





