Computers and Technology

Lab 12B: Palindromes with Files Overview
This is a demonstration of reading and writing files.
Objectives
Be able to read from an input file, perform string manipulation on each line of the file, and write to an output file.
Provided input file:
A single input file named something like myinput. txt is provided that contains a few lines of text.
Description
Create a program to read each line of an input file, determine if the text on the line is a palindrome, and write "palindrome' or 'not a palindrome' to the output file depending on the input. Recall from lab 16.23 that a palindrome is a word or a phrase that is the same when read both forward and backward. In this program, you need to ignore spaces when determining if a phrase is a palindrome. Examples are: 'bob," "sees," or "never odd or even" (ignoring spaces).
You will read the line from a text file, use a function called palindromeChecker to determine if the line is a palindrome. Your function should take a string and return either the string palindrome or not a palindrome, as applicable.
You will write the results to a text file and display the results to the user as shown below.
You may refer to labs 8C and 13B and reuse your code from those labs, as applicable.
Sample Output to the file from the Provided Input File
palindrome
palindrome
not a palindrome
palindrome
not a palindrome
palindrome
Sample Output to the User from the Provided Input File
bob ==> palindrome
sees ==> palindrome
over the moon ==> not a palindrome
never odd or even ==> palindrome
statistics ==> not a palindrome
dr awkward ==> palindrome

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 22:00, zay179
What is a distinguishing feature of today’s graphic application software?) graphic applications are used today on a variety of devices, including touch-screen kiosks and mobile phones.
Answers: 3
image
Computers and Technology, 24.06.2019 13:30, nina288
What process should be followed while giving a reference? sam has given a reference of his previous manager in his resume. sam should him in advance that the potential employers will him.
Answers: 1
image
Computers and Technology, 25.06.2019 03:30, sduihasoj1703
What best describes the purpose of occupational safety and health administration
Answers: 1
image
Computers and Technology, 25.06.2019 07:00, kjmesser33
Quick styles allow you to format an entire document quickly? t/f
Answers: 1
Do you know the correct answer?
Lab 12B: Palindromes with Files Overview
This is a demonstration of reading and writing fil...

Questions in other subjects: