This is what I have
import java.util.Scanner;
public class A9 {
public static String getPhrase () {
Scanner input = new Scanner(System.in);
System.out.print ("Enter a phrase: ");
String phrase = input.nextLine();
return phrase;
}
public static void reportPhrase (String phrase) {
System.out.println (phrase);
}
public static void printHistogram (String phrase) {
for(int i=0;i <phrase.length();i++){
if((phrase.charAt(i) == 'a') ||
(phrase.charAt(i) == 'e') ||
(phrase.charAt(i) == 'i') ||
(phrase.charAt(i) == 'o') ||
(phrase.charAt(i) == 'u')) {
System.out.println(phrase.charAt(i) + ": ");
for (int j = 0; j < phrase.length(); j++) {
System.out.print("*");
}
public static void main(String args[]) {
String phrase;
phrase = getPhrase ();
reportPhrase (phrase);
printHistogram (phrase);
// Call the method printHistogram here
}
}
and the output is this
Enter a phrase: frederator
frederator
e:
**********e:
**********a:
**********o:
**********
Can someone rewrite it to make an output more like this?
ex " Alphabet soup is my favorite soup in the whole world."
a: * * *
e: * * * *
i: * * *
o: * * * * *
u: * *