APlusGrades

Not Rated (0)

$15/per page/Negotiable

About APlusGrades

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing,Foreign Languages,Geography,Geology,Health & Medical,HR Management,Law,Management,Physics,Programming,Science,Statistics Hide all
Teaching Since: Jul 2017
Last Sign in: 364 Weeks Ago, 2 Days Ago
Questions Answered: 1850
Tutorials Posted: 1850

Education

  • Graduate in Biology and Nutrition, MBA Finance
    Florida State University
    Aug-2000 - Jul-2007

Experience

  • Ass. Relationship Manager
    Penn-Florida
    Mar-2009 - Feb-2016

Category > Programming Posted 17 Jul 2017 My Price 12.00

construction of a program

Assignment #11 will be the construction of a program that takes an input string, and check if parentheses and braces in each string are matching or not.

The method checking() in the Matching class needs to check if parentheses and braces in the parameter string is matching or not using an object of the Stack class in java.util package.

 

Instruction:

 

 

Assignment11 class

This class displays a menu for the parentheses or braces checking. If a user enters "P", then it asks to enter a string. This class is given by the instructor.

 

Matching class

You need to complete the following method.

public static int checking(String inputString)

You need to write the checking method that takes an input string, and read every character from its left to right, then returns 0, 1, 2, 3, or 4 based on the following description.

It should create an empty Stack object at the beginning, and if a character is a left parenthesis '(' or a left brace '{', then push it (or its corresponding string such as "(" or "{") onto the stack. 

If a character is a right parenthesis ')' and the top of the stack is '(', then pop it and continue to process the next character of the input string. But if the top of the stack is not '(' or the stack is empty, then that means that there was no matching left parenthesis, thus the method should return 1. 

If a character is a right brace '}' and the top of the stack is '{', then pop it and continue to process the next character of the input string. But if the top of the stack is not '{' or the stack is empty, then that means that there was no matching left parenthesis, thus the method should return 3. 

After reading all characters of the input string, if the stack is empty, then it means that everything is matching, the method should return 0. 

After reading all characters of the input string, if the stack is not empty, and the top of the stack is a left parenthesis '(', then there was no matching right parenthesis, thus the method should return 2. 

After reading all characters of the input string, if the stack is not empty, and the top of the stack is a left brace '{', then there was no matching right brace, thus the method should return 4. 

 

The error messages are based on the first parenthesis or brace from left of the input string that does not have any matching.

 

Requirements:

You need to implement this method using an object of the Stack class) in java.util package.

Answers

Not Rated (0)
Status NEW Posted 17 Jul 2017 05:07 PM My Price 12.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â-----------  -----------Tha-----------nk -----------you----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m Â----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I

Not Rated(0)