I'm trying to figure what i need to put to break this do while loop. This program should only respond to a, b, or c and if the user puts any other letter the loop will end.
P.S
I'm new at this whole java forums thing so sorry if I do anything wrong. Also for some reason my computer, an imac, won't let me upload any attachments to this post, so i'm just going to past the code underneath this.
package c5r2abc;
import cs1.Keyboard;
public class C5R2abc {
public static void main(String[] args) {
//Variables
int count = 0, count1 = 0, count2 = 0;
char choice;
//Enter a letter
System.out.println("Enter either \'a\', \'b\', or \'c\' when prompted");
System.out.println("enter any other letter to quit");
System.out.println("\nEnter letter: ");
choice = Keyboard.readChar();
//Do while loop
do{
if(choice == 'a'){
System.out.println("A is for apple.");
count = count + 1;
}
if(choice == 'b'){
System.out.println("B is for baby.");
count1 = count1 + 1;
}
if(choice == 'c'){
System.out.println("c is for Chicago.");
count2 = count2 + 1;
}
System.out.println("\nEnter letter: ");
choice = Keyboard.readChar();
}while(choice != )
}
}
