Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

editOut should take a String as input and output a String. You may assume the input String has properly matched parentheses. The behavior for improperly

editOut should take a String as input and output a String. You may assume the input String has properly matched parentheses. The behavior for improperly matched parentheses is up to you, but the method should not crash. The output String should be identical to the input String except that any text inside a pair of matched parentheses is removed, including the parentheses. In addition, if there is a pair of matched parentheses inside the removed text, that text should be retained (though the parentheses should be removed). If there are any matched parentheses inside the retained text, that text should be removed, and so on. editOut("this is an (unusual (example)) of (editing out and (retaining)) text") should return "this is an example of retaining text" editOut("this is (another) (example) showing (((((removal))))) -( and )- ((((retention))))") should return "this is showing -- retention"

You are allowed to use the following from the Java API:

class String

length

charAt

class StringBuilder

length

charAt

append

toString

class Character

any method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions