Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add a class called NoDuplicates (similar to the class Reverser) to the program which reverses a word on screenshot below (A and B) This class

Add a class called NoDuplicates (similar to the class Reverser) to the program which reverses a word on screenshot below (A and B)

This class should have a constructor and one method called noDups(). The noDups() method should accept a string and return the string with all consecutive duplicate characters removed. The noDups() method must use a stack to remove the duplicate characters. That is, this class must make use of the class StackX.

Revise the main() method in the class ReverseApp to exercise the noDups() method.

Sample I/O: image text in transcribed

A)

image text in transcribed

B)

image text in transcribed

Enter a string (a to quit): Mississippi No Duplicates: Misisipi Enter a string (a to quit): Mamma Mia! Song by ABBA. No Duplicates: Mama Mia! Song by ABA. Enter a string (a to quit): Multiple spaces between No Duplicates: Multiple spaces betwen words. Enter a string (g to quit): a words. Enter a string (a to quit): Mississippi No Duplicates: Misisipi Enter a string (a to quit): Mamma Mia! Song by ABBA. No Duplicates: Mama Mia! Song by ABA. Enter a string (a to quit): Multiple spaces between No Duplicates: Multiple spaces betwen words. Enter a string (g to quit): a words

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions