I can ot get my output to reflect accurate info, does anyone have a possible solution?
///////////////////////////////////////////////////////////
import java.util.Scanner;
public class Count
{
public static void main (String[] args)
{
String phrase; // a string of characters
int countBlank; // the number of blanks (spaces) in the phrase
int length; // the length of the phrase
int countA = 0; // the number of a's in the phrase
int countT = 0; // the number of t's in the phrase
char ch; // an individual character in the string
Scanner scan = new Scanner(System.in);
// Print a program header
System.out.println ();
System.out.println ("Character Counter");
System.out.println ();
// Read in a string and find its length
System.out.print ("Enter a sentence or phrase ('quit' to quit): ");
phrase = scan.nextLine();
length = phrase.length();
// Initialize counts
countBlank = 0;
// a while loop to allow user to keep entering phrases
while (!phrase.equals("quit"))
phrase = scan.nextLine();
length = phrase.length();
{
// a for loop to go through the string character by character
// and count the blank spaces
for(int i = 0; i < phrase.length(); i++)
{
ch = phrase.charAt(i);
switch (ch)
{
case ' ': countBlank++;
break;
case 'a':
case 'A': countA++;
break;
case 't':
case 'T': countT++;
break;
}
}
// Print the results
System.out.println ();
System.out.println ("Number of blank spaces: " + countBlank);
System.out.println ("Number of A's: " + countA);
System.out.println ("Number of T's: " + countT);
System.out.println ();
}
}
}
////////////////////////////////////////////////////////////