java - Trouble with my conditions statement -


i trying make condition user checked 3 numbers. cannot seem figure out, want make sure user chooses 1 of these 3 numbers.

system.out.println("how big want pizza? enter size of: 10, 12, or 14 inches."); size = scan.nextint(); while( size != 10 )  <=====(**problem**) {     system.out.println("that not valid size. choose again.");     size = scan.nextint(); } 

you want continue looping until 10, 12, or 14, use

while (size != 10 && size != 12 && size != 14) {     ... } 

or its equivalent

while (!(size == 10 || size == 12 || size == 14)) {     ... } 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -