|
@@ -1,9 +1,31 @@
|
1
|
1
|
/**
|
2
|
|
- * Created by iyasuwatts on 10/17/17.
|
|
2
|
+ * Trinh Tong
|
|
3
|
+ * Lab - Alice and Bob
|
|
4
|
+ * Using the scanner to take an input and then display the message
|
|
5
|
+ * with the user's keyboard input.
|
3
|
6
|
*/
|
|
7
|
+import java.util.*;
|
|
8
|
+
|
4
|
9
|
public class Main {
|
5
|
10
|
|
6
|
11
|
public static void main(String[] args ){
|
7
|
|
-
|
8
|
|
- }
|
|
12
|
+
|
|
13
|
+ Scanner keyboard = new Scanner(System.in);
|
|
14
|
+
|
|
15
|
+ System.out.println("Please enter your name.");
|
|
16
|
+
|
|
17
|
+ String name = keyboard.nextLine();
|
|
18
|
+
|
|
19
|
+ String returnLine = "Hello, " + name + ".";
|
|
20
|
+
|
|
21
|
+ if (name.equalsIgnoreCase("Alice")) {
|
|
22
|
+ System.out.println(returnLine);
|
|
23
|
+ } else if (name.equalsIgnoreCase("Bob")) {
|
|
24
|
+ System.out.println(returnLine);
|
|
25
|
+ } else {
|
|
26
|
+ System.out.println("You aren't Alice or Bob!");
|
|
27
|
+ }
|
|
28
|
+ }
|
|
29
|
+
|
9
|
30
|
}
|
|
31
|
+
|