Part 1 Design and implement an application named as ReverseCharacters that reads
ID: 3564890 • Letter: P
Question
Part 1
Design and implement an application named as ReverseCharacters that reads a sentence from the user and prints the sentence with the characters of each word backwards. You must use a stack to reverse the characters of each word. Use the package provided for you with these requirements to complete this work. Document if there is any pre or post conditions for your method(s). Include data validation of some form in your code.
Part 2
Implement a class called ReverseWords that uses a stack to output a set of elements input by the user in reverse order. You must use a stack to reverse the characters of each word. Use the package provided for you with these requirements to complete this work. Document if there is any pre or post conditions for your method(s). Include data validation of some form in your code.
Part 3
Create a graphical application StackDemoGUI that provides a button for push and pop from a stack, a text field to accept a string as input for push, and a text area to display the contents of the stack after each operation.
Explanation / Answer
(1)
have this string s1 = "My name is X Y Z" and I want to reverse the order of the words so that s1 = "Z Y X is name My".
I can do it using an additional array. I thought hard but is it possible to do it inplace (without using additional data structures) and with the time complexity being O(n)?
(2)
(3)