Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C+ Write a method for a class named Palindrome that evaluates a string phrase to determine if the phrase is a palindrome or not.

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
In C+ Write a method for a class named Palindrome that evaluates a string phrase to determine if the phrase is a palindrome or not. A palindrome is a sequence of characters that reads the same both forward and backward. When comparing the phrase to the same phrase with the characters in reverse order, an uppercase character is considered equivalent to the same character in lowercase, and spaces and punctuation are ignored For this assignment, most of the code is completed. Click here to download the files needed for this Lab. Review the included files. The main) method uses the overloaded constructor to declare several objects and initialize them to various phrases to test your program for correctness. For each test phrase, the application outputs a message about whether the phrase is a palindrome or not (based on the value returned by evalPalindrome0) the original phrase, and the phrase in reverse order (using the value of reversePhrase changed by evalPalindrome0) For this lab assignment, implement the evalPalindrome) method, as defined in the Javadoc comments found inside the class definition above. The method you write MUST make use of ArrayStack named letters to reverse the order of the original phrase and to determine if the phrase is a palindrome or not. In other words, the method you write must call the methods in the ArrayStack class to reverse the order of the original phrase and to determine if it is a palindrome. Note that a library named cctype is included in Palindrome.h. This library contains methods like toupper0, tolower isalpha), and ispunct0, which you may find useful. Only the evalPalindrome) method in Palindrome.cpp needs to be modificd, everything clse is good. Stack Main.epp #include #include-iostream> include # include #include #include "Palindromeh" using namespace std; void testForPalindrome(string origPhrase); int main (void) const int NUM PHRASES 4 string all PhrasesINUM PHRASES] "kayak" "Read dear" "Madam, I'm Adam" "The End" for (int i-0; i class ArrayStack: public StackInterface hem Type privale: ltemType items[MAX STACK]: int top Amay of stack items W Index to top of stacik ArrayStacko bool isEmpty0 const; bool push(const ItemType& newEntry bool popo ItemType peck) const; N Default constructor Wand ArrayStack include "Array Stack cpp" #endif

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 Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

You have

Answered: 1 week ago