Question: IN JAVA: /** * CSCIProjectTwo: Use MyStack and MyQueue to write a project that check if a sentence is palindrom * * @author Your name

IN JAVA:

/** * CSCIProjectTwo: Use MyStack and MyQueue to write a project that check if a sentence is palindrom * * @author Your name * @version Date */ import java.util.Scanner; public class CSCI463ProjectTwo { public static void main(String [] args) { Scanner input = new Scanner(System.in); String sentence; String again; do{ System.out.println("Enter a sentence, I will tell you if it is a palindrome: "); sentence = input.nextLine(); if(isPalindrome(sentence)) System.out.println("\"" + sentence + "\" is a palindrome!"); else System.out.println("\"" + sentence + "\" is not a palindrome!"); System.out.println("Do you want another test (\"YES\" or \"NO\"): "); again = input.nextLine(); }while(again.equalsIgnoreCase("YES")); } /** * isPalindrom returns true if the given String is a palindrom * @ */ public static boolean isPalindrome(String sentence) { // declare a MyStack s // declare a MyQueue q for(int i = 0; i < sentence.length(); i++) { // if ith character in sentence is a letter // convert to upper case and push it into s and q } while(!s.isEmpty()){ // if the front of the queue not match the top of stack // return false // pop out top of the stack and front of the queue } return true; } }

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!