Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a void method called palindromeCheck that takes NO argument. The method should have functionality to check whether or not the word is a palindrome
Write a void method called palindromeCheck that takes NO argument. The method should have functionality to check whether or not the word is a palindrome and print to the screen all of the palindromes, one per line. (java)
This program reads words, identifies, counts and writes all the palindromes and the total t palindrome count public static void palindromeCheck) String someword = "" ". int count = 0 int total = 0 // keeps track of Palindrome words only (define algorithm to count # of palindrome words / Counts the total number of lines read from the given text file System.out.println(" Enter some words separated by white space") // declare your Scanner object here Scanner keyboard new Scanner (System.in); // hint 1: Using keyboard.next() will only return what comes before a space // hint 2: Using keyboard.nextLine() automatically reads the entire current line for each word user enters while (keyboard.hasNext()) someWord = keyboard.next(); // store each word in a string variable and then do your operations / increment number of words as you read each one total++ // #1. Code your logic for how to determine if a word is Palindrome first, then complete # 2 System.out.println("total+someWord) // test // if encountered ENTER then close scanner stream and terminate keyboard.close(): /Ix is a variable for count and y is variable total // #2, print "There are x palindromes out of y wordsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started