
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 nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images

- Write a program in Java to count the total number of vowels and consonants in a String. The string can contain all the alphanumeric and other special characters as well. However, only the lowercase English alphabets are allowed in the String.arrow_forwardIn Java: Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or 1995! the output is: no Hint: Use a loop and the Character.isDigit() function.arrow_forwardIn JAVA language. Given a string jv = "JAVA", write a program such that the string to be printed in output should be "AVAJJAVA".arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





