I need help writing a Java program based on String. Write a program that will read a line of text as input and then display the line with the first word moved to the end of the line. For example, a possible sample interaction with the user might be the Output below: { Enter a line of text. No punctuation please. This is a sample line of text. I have rephrased that line to read: Is a sample line of text. This } Assume that there is no space before the first word and that the end of the first word is indicated by a blank, not by a comma or other punctuation. Note that the new first word of the sentence must begin with a capital letter. Do not use this sample line of text but rather one of your own. I need to use the methods of the String class to take this sentence apart and put it back together again. Methods indexOf(), the two substring() methods, and ToUpperCase() will be useful. As I take the string apart create variables to hold the parts. Variables firstWord, stringWithoutFirstWord, newSentence, firstCaracter, finalSentence and inputString are descriptive variable names that will document what my program is doing
I need help writing a Java program based on String.
Write a program that will read a line of text as input and then display the line with the first word moved to the end of the line. For example, a possible sample interaction with the user might be the Output below:
{
Enter a line of text. No punctuation please.
This is a sample line of text.
I have rephrased that line to read:
Is a sample line of text. This
}
Assume that there is no space before the first word and that the end of the first word is indicated by a blank, not by a comma or other punctuation. Note that the new first word of the sentence must begin with a capital letter. Do not use this sample line of text but rather one of your own.
I need to use the methods of the String class to take this sentence apart and put it back together again.
Methods indexOf(), the two substring() methods, and ToUpperCase() will be useful. As I take the string apart create variables to hold the parts. Variables firstWord, stringWithoutFirstWord, newSentence, firstCaracter, finalSentence and inputString are descriptive variable names that will document what my program is doing.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images