Answered step by step
Verified Expert Solution
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:
A)
B)
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 wordsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started