Create a TestStack project. Add a Stack class with all of the methods implemented and commented (constructor, push, pop, is empty, clear, peek, toString). Create a TestStack class with main(). main() should use your Stack class to do one of the following: OPTION A) Use your stack class to reverse a user inputted string. A palindrome is a word that reads the same backwards as it does forwards. For example, madam is a palindrome, hello is not. Use your stack class to test if an input string is a palindrone or not. OPTION B) Use your new Stack to add a function that checks for balanced parenthese in an equation. Use these three equations, plus one of your own to test your code. ((3^2 + 8)*(5/2))/(2+6) ((3^2 + 8)*(5/2))/(2+6)) (((3^2 + 8)*(5/2)/(2+6) When encountering a left parenthese, push it on the stack. Pop one off when you encounter a right parenthese. Return true or false depending if parentheses are balanced or not (stack is empty after last right parenthese causes a pop. OPTION C) convert an infix expression to a postfix expression so that (6 + 2) * 5 - 8 / 4 becomes 6 2 + 5 * 8 4 / - read infix characters from left to right and do the following: if the current character is (, push it on the stack if the current character is a digit, append it to the end of the postfix string if the current character is an operator, pop opertors (if any) from the top of the stack while they have equal or higher precedence than the current character and append the popped operators onto the postfix string. Push the current character onto the stack. If the current character is the right parenthese Pop operators from the top of the stack and append them in the postfix string until a left parethses is at the top of the stack Pop and discard the left parethesis from the stack If all characters from the infix string have been processed and the stack is not empty, pop all the values from the stack

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
Create a TestStack project. Add a Stack class with all of the methods implemented and commented (constructor, push, pop, is empty, clear, peek, toString). Create a TestStack class with main(). main() should use your Stack class to do one of the following: OPTION A) Use your stack class to reverse a user inputted string. A palindrome is a word that reads the same backwards as it does forwards. For example, madam is a palindrome, hello is not. Use your stack class to test if an input string is a palindrone or not. OPTION B) Use your new Stack to add a function that checks for balanced parenthese in an equation. Use these three equations, plus one of your own to test your code. ((3^2 + 8)*(5/2))/(2+6) ((3^2 + 8)*(5/2))/(2+6)) (((3^2 + 8)*(5/2)/(2+6) When encountering a left parenthese, push it on the stack. Pop one off when you encounter a right parenthese. Return true or false depending if parentheses are balanced or not (stack is empty after last right parenthese causes a pop. OPTION C) convert an infix expression to a postfix expression so that (6 + 2) * 5 - 8 / 4 becomes 6 2 + 5 * 8 4 / - read infix characters from left to right and do the following: if the current character is (, push it on the stack if the current character is a digit, append it to the end of the postfix string if the current character is an operator, pop opertors (if any) from the top of the stack while they have equal or higher precedence than the current character and append the popped operators onto the postfix string. Push the current character onto the stack. If the current character is the right parenthese Pop operators from the top of the stack and append them in the postfix string until a left parethses is at the top of the stack Pop and discard the left parethesis from the stack If all characters from the infix string have been processed and the stack is not empty, pop all the values from the stack
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Stack
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education