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) { ... }
while (!(size == 10 || size == 12 || size == 14)) { ... }
Comments
Post a Comment