Validate the pairing of parenthesis in an expression

Assignment Help Programming Languages
Reference no: EM131148646

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.

Reference no: EM131148646

Questions Cloud

What would you expect would happen to the cost of equity : What would you expect would happen to the cost of equity if you had to raise it by selling new equity, and why? If the after-tax cost of debt is always less expensive than equity, why don't firms use more debt and less equity? What are some of the..
Discuss how energy is stored in capacitors and inductors : Discuss how energy is stored in capacitors and inductors. Are the equations linear or non-linear? How do you know? Discuss the concept of duality and why it applies to many fundament engineering concepts.
Describe the type of common chemical hazards : Describe the type of common chemical hazards that are present in your local environment, similar to those illustrated in the Tox Town interactive.
What can airlines do to improve customer experience using it : What can airlines do to improve the customer experience using IT? Explain how you would use IT to decrease wait times at TSA security lines.
Validate the pairing of parenthesis in an expression : 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 ta..
Compute the break even sales : ompute the break even sales (units). - How many units of each product, MP3 players and satellite radios, would be sold at the break even point?
Describe how electric current is generated and transported : Describe how an electric current is generated and transported. Assess the current state of our national grid in the United States, as well as any challenges in updating this grid.
Identify a general plan to recover from the incident : Identify additional software that will be required to monitor the network and protect key assets. Identify any security controls that need to be implemented to assist in mitigating risks. Mitigate all of the risks that were identified during the asse..
Describe the differences between temperature and heat : Describe the differences and similarities between temperature and heat. Analyze how heat transfer occurs during the processes of conduction and convection. Provide an example of where each occurs in natural physical systems.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create new method for random turning

Create new method named randomTurn (this method has no parameters and returns nothing). Select the code that does the random turning.

  Program to give and take advice on program writing

Write down the program which gives and takes advice on program writing. Program starts by writing the piece of advice to screen and asking user to type in different advice.

  Write program to accept data for each student

Write a program that accepts data for each student in the school - Student ID, classroom number, and score on the achievement test. Design a program that lists the total points scored for each of the 30 classrooms.

  Determine the number of the nearest cross street

Write a function that uses a switch statement to determine the number of the nearest cross street for a given address and avenue number according to the preceeding alogorithm. Then write a program to test your function.

  Choose two different formats for audio and with each record

Choose two different formats for audio and with each record a short passage of speech and a short passage of music. Try to discern any difference in quality. What do you think?

  Define a class rewardcard as an adt

Determine the cost of the two_day_ package represented by the instantiated object, then display the calculated cost also on the console - Define a class RewardCard as an ADT that uses separate files for the interface and the implementation

  Program to input name and price of the item

Program must input name and price of the item and its weight in pounds and ounces. Then it must determine and display unit price per ounce of that item.

  Store a list of items on a grocery list

write a program that uses a string array to store a list of items on a grocery list. The program should allow the user (via a menu) to add an item to the list, clear the list, and display the list.

  Visual basic programming

Write a 1- to 2-page paper discussing what online groups or sites you will follow to get insight into using Visual Basic® programming in your work or career?

  Write void function which reads game-s parameters from file

Write a void function which reads game's parameters from file. Function validates te parameters. If parameters are "bad" the function assigns default values to parameters.

  Code to sum of all the elements of the array

Write some code that places the sum of all the elements of the array x into total. Declare any variables that you need.

  Write a program which defines an integer array of size

Write a program which defines an integer array of size three (3), the size of the array should be a constant variable. Read data using loops for this array from the user. The data of this array will be the number of vacation days of an employee in..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd