i am lost on this assignment
i have 2 problems 1 is printing using for loop and the other is i can not get a to count. Would gratly appreciate any help.
Here is what i got below is the desired output.......
import java.util.*;
public class Lab3_Count {
public static void main(String[] arguments) {
String s;
int i;
int[] Count = new int[26]; // letter count array 26 elements
do {
System.out.printf("Enter a string");
Scanner stdin = new Scanner(System.in);
stdin.useDelimiter("\n"); // Use a newline to break input
s = stdin.next();
s = s.toUpperCase();
for (i=0; i<s.length(); i++){
if (s.charAt(i) == 'A')
Count[0]++;
if (s.charAt(i) == 'B')
Count[1]++;
if (s.charAt(i) == 'C')
Count[2]++;
}
while (s.length()>1); {
for (i=0;i<26;i++){
System.out.printf ("%d", Count[i]);
}
}
}
}
Enter some text - ENTER on a blank line to terminate
This is a test of Lab3_Histogram
The program analyzes text entered at the keyboard
The occurance of each character is displayed as a count and also
in chart form using a simple text histogram
A=20 ********************
B=02 **
C=08 ********
D=05 *****
E=16 ****************
F=03 ***
G=04 ****
H=09 *********
I=09 *********
J=00
K=01 *
L=05 *****
M=05 *****
N=07 *******
O=10 **********
P=03 ***
Q=00
R=11 ***********
S=12 ************
T=17 *****************
U=03 ***
V=00
W=00
X=02 **
Y=03 ***
Z=01 *