Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in java palindrome: a word, phrase, or sequence that reads the same backward as forward, e.g., madam Objective: Prompt the user for a word

code in java

palindrome: a word, phrase, or sequence that reads the same backward as forward, e.g., madam

Objective: Prompt the user for a word and then check if that word is a palindrome using a Stack data structure.

Requirements:

1) Only a single main class is required

2) The main class must contain a static method called "getInputWord" that prompts a user to input a word from the keyboard and returns that word as a String. This method must use "JOptionPane.showInputDialog" to get the input from the user (you can find info about JOptionPane in JavaDocs)

3) The main class must contain a static method called "palindromeCheck" that takes a String as an input argument and returns a boolean indicating whether or not that String is a palindrome. This method must utilize a Stack data structure to determine whether the word is a palindrome. Hint: Use the charAt() method of the String class to access each character of the word

Flow of the Program:

1) Read in a word from the user by calling your "getInputWord" method

2) Check if the word is a palindrome using your "palindromeCheck" method

3) Output the result to the screen using "JOptionPane.showMessageDialog" (you can find info about JOptionPane in JavaDocs)

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

2. When does a country become an exporter of a good? An importer?

Answered: 1 week ago