Question: Write a java program that has a user input a sentence. Each word in that sentence will be tokenized. If the first letter of the
Write a java program that has a user input a sentence. Each word in that sentence will be tokenized. If the first letter of the word is an 'a', it prints out that word + "yay". If the word begins with any other letter it removes the first letter and places it at the end of the word and adds "ay" to it.
So the sample code for one word is below. I need the program to do this for each word in the sentence. Thanks!
char first = input.charAt(0); if (first == 'a') System.out.println(input + "yay"); else System.out.println(input.substring(1) + first + "ay");
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
