Write a program that uses a while loop. In each iteration of the loop, prompt the user to enter a number – positive, negative, or zero. Keep a running total of the numbers the user enters and also keep a count of the number of entries the user makes. The program should stop whenever the user enters “q” to quit. When the user has finished, print the grand total and the number of entries the user typed.

I can get this program to work when I enter a number like 0, to terminate the loop. But I have no idea how to get it so that a string stops it. 

```
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int count = 0;
    int sum = 0;
    int num;
    System.out.println("Enter an integer, enter q to quit.");
    num = in.nextInt();
    while (num != 0) {
        if (num > 0){
        sum += num;
        }
        if (num < 0){
        sum += num;  
        }
        count++;
        System.out.println("Enter an integer, enter q to quit.");
        num = in.nextInt();
    }
    System.out.println("You entered " + count + " terms, and the sum is " + sum + ".");

}

```