Question: 3. String Manipulation Working with text is a major task in a variety of computer science problems. Reading from files, data streams, or the user

3. String Manipulation Working with text is a major task in a variety of computer science problems. Reading from files, data streams, or the user requires examination and potentially manipulation of the input in order to transform the data into a useful form. To get a bit of practice you will start out working with palindromes. A palindrome is a word that reads the same backwards as forwards, i.e. madam, racecar, kayak. In order to test whether a word is a palindrome or not, we need to test if the first letter is the same as the last letter, the second letter is the same as the second to last letter, and so on. For this program you will be writing a simple palindrome tester that will test three, four, and five letter words. First, you will need to prompt the user for a word of length three, four, or five and store that in a string. You will also need a Boolean variable, initialized to false, to store whether the user's word is a palindrome or not. Next, you will need to determine how many characters are in the palindrome using the length 0 function for a string. In the case of a five letter word, you will need to compare the first and last character, and the second and second to last character to see if they are the same. If they are, set the Boolean variable to true You will need to similarly test four letter words and three letter words. If the word is more than five characters or less than three, you should alert the user of their mistake. Finally, based on the value of the Boolean variable, you should inform the user that their word was either a palindrome or that was not a palindrome or the wrong size. For example, if the user entered madam, your program should output that it was a palindrome. If the user entered mister, your program should output that it was either not a palindrome or the wrong size. If the user entered racecar, your program should output that it was either not a palindrome or the wrong size Complete this program, and then save the file as Lab4C cPp, making sure to compile and run the program to verify that it produces the correct results. Note that you will submit this file to Canvas FS F9 F10 F1 F12 0 delete
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
