Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!