The program will be:
import java.io.IOException;
import java.util.Scanner;
/* This class represents a Node in Expression Tree that will contain a digit(symbol) and will have links to its
* left and right childs, which would be recursively having its own left and right sub childs accordingly
*/
class Node {
public char data; // Store Node Data
public Node leftChild; // pointer to left sub tree
public Node rightChild;// pointer to right sub tree
// Constructor to initialize Node with data
public Node(char x) {
data = x;
}
// display the Node's data stored
public void displayNode() {
System.out.print(data);
}
}
/* This is Stack class (Stack1) which performs push(), pop(), isEmpty() operation on Node's data */
class Stack1 {
private Node[] a; // Stack of type Node
private int top, m; // top = top of stack variable, m = Maximum Size of the Stack
public Stack1(int max) {
m = max;
a = new Node[m];
top = -1;
}
What is a have program?Java is a popular object-oriented programming language and software platform that powers billions of devices such as notebook computers, mobile devices, gaming consoles, medical devices, and many more.
Java's rules and syntax are based on the C and C++ programming languages. The program is illustrated based on the information.
Learn more about program on:
https://brainly.com/question/26642771
#SPJ1