import java.util.Scanner;
public class Program2{
public static void main (String []args) {
Scanner input = new Scanner (System.in);
int[] data = new int[256];
int inAscii;
char inChar;
String inString= input.nextLine();
for (int i = 0; i < inString.length();i++) {
inChar=inString.charAt(i);
inAscii=(int) inChar;
data[inAscii]++;
}
for (int i= 1; i<256; i++){
int[] count= new int[256];
if (count[i] !=0){
if(count[i] > 1)
System.out.printf(" character: %c, ASCII#: %3d, occurs %2d times\n",
(char)i , i , data[i]);
else
System.out.printf("character: %c, ASCII: %3d, occurs %2d time\n",
(char)i, i,data[i]);
}
}
}
}
`this is what i have so far and i wanna knbow what is missing..
the output should look like this:
Input:
Please enter a string and press ENTER to end.
int i=1;i++,1=1;
Output:
character: , ASCII#: 32, occurs 1 time
character:+, ASCII#: 43, occurs 2 times
character:,, ASCII#: 44, occurs 1 time
character:1, ASCII#: 49, occurs 3 times
character:;, ASCII#: 59, occurs 2 times
character:=, ASCII#: 61, occurs 2 times
character:i, ASCII#:105, occurs 3 times
character:n, ASCII#:110, occurs 1 time
character:t, ASCII#:116, occurs 1 time
Program 2 is developed by