Compile and run the program to make sure it works. Try it out for at least three cases: a sequence of several temperatures; just one valid temperature; no valid temperatures (enter 999 for the first temperature).
ch = phrase.charAt(i);assigns the variable ch (type char) the character that is in index i of the String phrase. In your loop you can use an assignment similar to this (replace i with your loop control variable if you use something other than i). NOTE: You could also directly use phrase.charAt(i) in your if (without assigning it to a variable).
switch (ch) { case 'a': case 'A': countA++; break; case .... }Note that this switch uses the "fall through" feature of switch statements. If ch is an 'a' the first case matches and the switch continues execution until it encounters the break hence the countA variable would be incremented.
read in the first phrase (or "quit" if no phrases are to be entered) while the phrase is not "quit" { initialize the counters get the length of the phrase loop to "process" the phrase -- count the a's, e's, s's, t's, and blanks enter the next phrase or "quit" }Note that all you need to do is add the sentinel controlled while loop around the code you currently have. As in the temperature problem, the sentinel controlled loop has three important parts -- the loop control in the while statement, the priming read of the first phrase before the loop, and the reading of the next phrase at the end of the loop. Be sure that your prompts let the user know what to do to quit! Note that all of the initializations for the counts should be inside the while loop (that is, the counts should start over for each new phrase entered by the user). Be sure to go through the program and properly indent after adding code (with nested loops the inner loop should be indented). Let emacs do this for you -- first select the region you want to indent, then press Alt-Ctrl-\ ("indent region"). Voila!