Question: Write a program in java and do not forget to draw a flowchart that keeps prompting ( a loop is needed) for the user to

Write a program in java and do not forget to 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 output Without White space(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

/the program counts char in a string without whitespace and outputs the string without whitespace

import java.util.Scanner;

public class pro6_TextAnalyzer_method {

public static void main(String[] args) {

//type your code here

}

// Method counts the number of characters

public static int getNumOfCharacters(String ) { //a variable is needed after String

//type your code here

}

// Method outputs string without whitespace

public static void outputWithoutWhitespace(String ) { //a variable is needed after String

//type your code here

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!