I am creating a code where the user can:
Replace All: when the user types “replace all” the program will prompt the user to enter the character to change and the new character. (I have this section done)
Afterwards, it will replace all instances of the first character with the new character and prints the new string.
Replace Single: when the user types “replace single” the program will prompt the user to enter the character to change, the new character, and which instance it should replace. For example, if the user wanted the 3rd c in a sentence to be replaced. The user would enter the number 3 and it would only replace the 3rd c.
The program will then carry out the replacement and print the modified string
I am having difficulties though. I tried to get help from my T.A. but his handwriting is illegible, making it less than unhelpful. Please help if you can. I am using Java. The 4 string methods we can use are: charAt, length, equals (ignorecase), and substring. with the help of loops of course.