You are to write two programs one will validate palindromes


Programming Assignment - Palindromes & Parenthesis

Overview

You are to write two programs. One will validate palindromes; the other will validate the pairing of parenthesis in an expression. These programs must both use stacks. You can write either an array based stack, or a linked list to perform these tasks.

Details

These programs will require the implementation of a stack class. The stack class must minimally implement the following methods: push, pop, clear, isEmpty, and stackTop. Additionally each program will require a user interface to allow the entry of the required string data. The logic for the two programs is as follows:

Palindromes

Palindromes are sentences that spell the same forward as they do backward (irrespective of case, spaces, and punctuation). You need to pull each letter off a string, upper case it, and push it on the stack. While you do this build a string that contains the pushed letters in their original order (minus punctuation). When you are done, popping the data off the stack should equal the original string.

After processing a palindrome output whether it is or is not a palindrome.

Parenthesis

Verify that the number of left and right parenthesis is correct. Push left parenthesis onto the stack, pop off a parenthesis when you get a right parenthesis, on underflow you have too many right parenthesis, if you get to the end of the string, and the stack is empty, the parenthesis match, if it is not empty there are too many left parenthesis.

Display the status after processing a string.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: You are to write two programs one will validate palindromes
Reference No:- TGS01531963

Expected delivery within 24 Hours