Question: Write a program in java and draw a flowchart that keeps prompting ( a loop is needed) for the user to enter a string of
Write a program in java and draw a flowchart that keeps prompting ( a loop is needed) for the user to enter a string of their choosing as long as the string is not "quit". After each string entered, the program outputs the string, counts number of characters except for white space (spaces, tabs) in the user's string, also outputs the string's characters except for white space (spaces, tabs). Notes: the tab character is '\t'.
The program MUST have the following two methods, in additional to the main method (4 points):
(1) A method named getNumOfCharacters that returns the number of characters except for white space (spaces, tabs) in the user's string, the header of the method should be public static int getNumOfCharacters(String )
(2) )A method named outputWithoutWhitespace() that outputs the string's characters except for white space (spaces, tabs), the header of the method should be public static void outputWithoutWhitespace(String )
Here is an example of output
Enter a sentence or phrase: The only thing we have to fear is fear itself. You entered: The only thing we have to fear is fear itself. Number of characters: 37 String with no white space: Theonlythingwehavetofearisfearitself. Enter a sentence or phrase: How are you doing? You entered: How are you doing? Number of characters: 15 String with no white space: Howareyoudoing? Enter a sentence or phrase: quit You entered: quit The Program Ends
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
