Browse Source

Greeting Alice and Bob

Brandon Defrancis 6 years ago
parent
commit
6adbbf0716
2 changed files with 21 additions and 2 deletions
  1. 19
    0
      Main.java
  2. 2
    2
      package.bluej

+ 19
- 0
Main.java View File

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

+ 2
- 2
package.bluej View File

@@ -9,8 +9,8 @@ package.divider.horizontal=0.6
9 9
 package.divider.vertical=0.8007380073800738
10 10
 package.editor.height=427
11 11
 package.editor.width=674
12
-package.editor.x=181
13
-package.editor.y=109
12
+package.editor.x=587
13
+package.editor.y=201
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0