Stack Program ISC Computer Science 2022 Semester 2 Theory
A stack is a kind of data structure which can store elements with the restriction that an element can be added or removed from the top end only. The details of the class Stack is given below: Class name : Stack Data members/instance variables : cha[]: array to hold the characters size: stores the maximum capacity of the stack top: to point the index of the topmost element of the stack Member functions/methods : Stack(int m): constructor to initialize the data member size = m, top = -1 and create the character array void pushChar(char v): to add characters from the top end if possible else display the message "Stack full" char popChar(): to remove and return characters from the top end, if any, else returns '$' void display(): to display elements of the stack Specify the class Stack, giving details of void pushChar(char) and char popChar(). Assume that the other functions have ben defined. The main() function and algorithm need not be written. import java.util.Scanner...