design a balancedstring class having 2 members string str and a counter.the default constructor of balancedstring initializes str to the empty and resets counter to zero.the class's one-argument constructor passes a strings to str and resets counter to zero.the balancedstring class also provide a boolean method boolean balanced() that returs true if a stringcontains a blanced set of parentheses.
for example:
the string "((hello)(goodbye))" has balanced parentheses , but "((a)(b)(0)" does not. A string with no parentheses is balanced.
To check whether or not a string contains a balanced set of parentheses
scan the string, left or right
if a character is left parentheses ,increment the counter and
if a character is right parentheses, decrement the counter
A string is balanced if the final counter value equals(),and while scanning the string, the value of the counter is never negative.
please send the answer quicklz