Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that prompts the user for a sentence and outputs if the sentence was a palindrome or not. The program should keep on

Write a program that prompts the user for a sentence and outputs if the sentence was a palindrome or not. The program should keep on prompting the user for sentences until the user says differently!

Pseudocode:

- Prompt the user for the sentence to check

- Convert the sentence to all lowercase (or all uppercase) characters.

- Create a new string that will include only the alphabetic characters of the original sentence (no spaces/punctuation) Hint: use a for-loop

- Create a new string with the reverse version of the previous string Hint: use a for-loop (you saw this already in Part3 of this lab)

- Compare the two strings to make the decision

- Print the decision

- Repeat if the user says so

image text in transcribed

SAMPLE OUTPUT Welcome to the palindrome checker program! Enter a sentence: Never odd or even! This is a palindrome! Do you want to continue (yeso)? yes Enter a sentence: Hello world This is not a palindrome! Do you want to continue (yeso)? Yes Enter a sentence: racecar This is a palindrome! Do you want to continue (yeso)? yeah Enter a sentence: Madam, I'm Adam This is a palindrome! Do you want to continue (yeso)? No Goodbye

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions