Browse Source

greet Alice and Bob prompt

Jevit Tith 6 years ago
parent
commit
6b6c24a42f
2 changed files with 18 additions and 5 deletions
  1. 14
    1
      Main.java
  2. 4
    4
      package.bluej

+ 14
- 1
Main.java View File

@@ -1,9 +1,22 @@
1 1
 /**
2 2
  * Created by iyasuwatts on 10/17/17.
3 3
  */
4
+
5
+import java.util.*;
4 6
 public class Main {
5 7
 
6 8
     public static void main(String[] args ){
7
-
9
+        Scanner sc = new Scanner(System.in);
10
+        System.out.println("Hello, what is your name?");
11
+        String name = sc.nextLine();
12
+        if (name.equals("Alice")||name.equals("alice")) {
13
+            System.out.println("Hello Alice");
14
+        } else if (name.equals("Bob")||name.equals("bob")) {
15
+            System.out.println("Hello Bob");
16
+        }else {
17
+            System.out.println("Where is Alice and Bob");
18
+        }
19
+        //System.out.println(name);
20
+        
8 21
     }
9 22
 }

+ 4
- 4
package.bluej View File

@@ -1,8 +1,8 @@
1 1
 #BlueJ package file
2
-editor.fx.0.height=0
3
-editor.fx.0.width=0
4
-editor.fx.0.x=0
5
-editor.fx.0.y=0
2
+editor.fx.0.height=729
3
+editor.fx.0.width=1280
4
+editor.fx.0.x=13
5
+editor.fx.0.y=45
6 6
 objectbench.height=101
7 7
 objectbench.width=776
8 8
 package.divider.horizontal=0.6