Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Scenario: You are writing a small Java application that will prompt the user to enter a String phrase, and your application processes the phrase, extracting
Scenario: You are writing a small Java application that will prompt the user to enter a String phrase, and your application processes the phrase, extracting the following information: The longest word and its length The shortest word and its length The overall number of words The overall number of characters Count of the number of vowels that appear in the phrase (a, e, i, o, and u) The program will loop and allow the user to repeatedly enter new phrases, processing each new phrase after being entered. The user can enter-1 to quit the program (see below). Below, I have included a sample run of my application. Here are your requirements/restrictions: You cannot use the .next() method of the Scanner class to process the words individually. You must write your own logic, using String class methods, to extract each word and process it one at a time. You will of course need to use .nextLine(). You cannot use any methods of String or any other Class/library that do the work of extracting the individual words for you. Write your own logic! Normal String class methods are fine to use. Your program should allow the user to type in the phrase all as one complete sentence. Do not use arrays or any array-related methods for this assignment. Your logic must account for: O Phrases that have only one word. The last word must be included in your processing. O Blankspaces will be ignored and not processed in any counts. O Don't worry about punctuation. I wont put any in my test phrases Your logic must be able to handle any phrase, of any word count / length. If two words are the same length, the latter word "wins. ===================================== Please enter a new phrase to process ("-1 to quit"): bad grammar is not a good idea ========Processing Complete============ Vowel Count: a: 9 e: 16 i: 6 0: u: 3 Longest Word: "grammar", length: 7 Shortest Word: "a", length: 1 Overall Quantity of Words: 7, and characters: 24 ===================================== Please enter a new phrase to process ("-1 to quit"): -1
Step 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