The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 398 Weeks Ago, 3 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Show transcribed image text Write a program that checks whether or not a string of characters that has parenthesis is well formed. Write the method in the provided driver. Parenthesis are well formed if there is an open one then there must be matching closing one ). A stack is a good way to check. . Write in the method provided. Return true if the string was well formed and return false if it wasn?t . If there are no parenthesis in the string then it is well formed . The method char At may be something to look into . Use a stack to solve this When a (? is encountered push that one the stack When a )? is encountered pop off the stack If there is nothing to pop it is not well formed If the stack isn?t empty at the end then it is not well formed Example Dialog: Test number 0 is well formed! Test number 1 is well formed! Test number 2 is well formed! Test number 3 is wrong. All wrong Test number 4 is wrong. All wrong Test number 5 is well formed! Test number 6 is well formed!
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll