Please someone help me!!!
"ALL IS QUIET NOW, BUT WAIT!" must be inputted by the user and the output must show the the frequency of letters Q, A, E, and T. It should look like this
OUTPUT:
Q = 1
A = 2
E = 1
T = 3
public void createCharacterFinder() {
characterFinder = new JPanel();
characterFinder.setLayout(null);
JLabel enterLabel = new JLabel ("Antipolo Campus");
enterLabel.setBounds(100, 5, 260, 20);
characterFinder.add(enterLabel);
enterText = new JTextField();
enterText.setBounds(10, 35, 270, 70);
characterFinder.add(enterText);
JButton search = new JButton("Enter");
search.setBounds(50, 110, 200, 20);
search.addActionListener(this);
characterFinder.add(search);
countText = new JTextField();
countText.setBounds(10, 135, 270, 150);
characterFinder.add(countText);
}
public void actionPerformed(ActionEvent e) {
String st = enterText.getText();
char searchedChar = enterText.getText().charAt(0);
char [] charsToSearch = enterText.getText().toCharArray();
count(searchedChar, st);
}
public int count (char c, String str) {
int cnt = 0 ;
for (int i = 0;; cnt++) {
if ((i = str.indexOf(c, i)+1) == 0) break;
}
countText.setText(c+ " = "+cnt);
return cnt;
}