Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a project to perform manipulations on a string of characters. Write a program that will allow the user to change every occurrence of the
Write a project to perform manipulations on a string of characters. Write a program that will allow the user to change every occurrence of the space character with the string, "blank". Create two classes. Replacer class, which has at least two fields, the original string, stored in a string object and the converted string, stored in a StringBuilder object. (read the Java API documentation as shown in lecture) The constructor method should take a String as a parameter and assign it to both fields. You need a replace() method that will take in two parameters, the character to be replaced and the sequence of characters to replace it with. This method will use StringBuilder methods and logic to change all occurrences of the original string to a new string, while still preserving a copy of the original string. Write a get() method to get the original string. Write a get() method to get the converted string. Write a set() method to change the original string to a new string provided by the user. Driver class: Write a class with the main() method that tests your Replacer class. The user can enter strings, and convert each to another string using the replace() method that you wrote. Use the get() methods to print results to the screen. Allow the user to enter a brand new string until they decide they are done
Step 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