123456789101112131415161718192021222324252627282930
  1. /**
  2. * Created by iyasuwatts on 10/17/17.
  3. */
  4. import java.util.Scanner;
  5. public class Main {
  6. public static void main(String[] args ){
  7. String name;
  8. Scanner s = new Scanner(System.in);
  9. boolean aliceOrBob = false;
  10. System.out.print("Who are you? ");
  11. while (!aliceOrBob) {
  12. name = s.nextLine();
  13. if (name.equals("Alice") || name.equals("Bob")){
  14. System.out.println("Hello, " + name + "!");
  15. aliceOrBob = true;
  16. }
  17. else {
  18. System.out.println("Looking for Alice or Bob.");
  19. System.out.print("Who are you? ");
  20. }
  21. }
  22. s.close();
  23. }
  24. }