Answered step by step
Verified Expert Solution
Question
1 Approved Answer
******I need the java code ********** ******** please use the eclipse to solve the question and upload it and the same output have to come
******I need the java code **********
********please use the eclipse to solve the question and upload it and the same output have to come when we run the program******
String Operations Write a program that prompts for and reads in a line of text, and then performs the following tasks: Outputs the number of characters on the line. (Hint: The String class has a method named length() that returns the number of characters in a string.) Outputs the number of words on the line. (Hint: Break up the line of text with the method split using 1 or more whitespaces as a delimiter (\\s+"), and then output the size of the returned array.) Outputs the longest word on the line. (Hint: The split method breaks-up the line of text into words (or tokens), and stores those words into an array. Search that array to find out the longest word.) Outputs the words in ascending order. (Hint: The Arrays class has a method named sort that takes an array as an argument, and orders the elements of that array in ascending order.) Include a loop in the program that allows the user to repeat the above steps as often as (s)he/they wishes. Sample Input and Output: Programmer: Course: Lab#: Due date: Name of the programmer (your name) COSC 211, W22 2, part 1 1-27-2022 Enter a line of text: Hello to all Number of characters: 12 Number of words: 3 Longest word: Hello Words in ascending order: Hello all to Do it again, yes (or no)? Yes Enter a line of text: The fat cat sat on the mat in front of the door Number of characters: 47 Number of words: 12 Longest word: front Words in ascending order: The cat door fat front in mat of on sat the the Do it again, yes (or no)? noStep 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