Bladeren bron

Created coniditonal to check against Alice and Bob/ Print greetings to Alice & Bob

Elliott Stansbury 6 jaren geleden
bovenliggende
commit
50a61d348d
2 gewijzigde bestanden met toevoegingen van 15 en 4 verwijderingen
  1. 13
    2
      Main.java
  2. 2
    2
      package.bluej

+ 13
- 2
Main.java Bestand weergeven

1
+import java.util.Scanner;
1
 /**
2
 /**
2
  * Created by iyasuwatts on 10/17/17.
3
  * Created by iyasuwatts on 10/17/17.
3
  */
4
  */
4
 public class Main {
5
 public class Main {
5
 
6
 
6
-    public static void main(String[] args ){
7
-
7
+    public static void main( ){
8
+        Scanner user_input = new Scanner( System.in );
9
+        
10
+        System.out.print("What is your name? ");
11
+        String name = user_input.next();
12
+        
13
+        if(name.equals("Bob") || name.equals("Alice")) {
14
+            System.out.println("Hello there " + name);
15
+        } else{
16
+            System.out.println("Im sorry I don\'t know you");   
8
     }
17
     }
18
+    
19
+}
9
 }
20
 }

+ 2
- 2
package.bluej Bestand weergeven

9
 package.divider.vertical=0.8007380073800738
9
 package.divider.vertical=0.8007380073800738
10
 package.editor.height=427
10
 package.editor.height=427
11
 package.editor.width=674
11
 package.editor.width=674
12
-package.editor.x=181
13
-package.editor.y=109
12
+package.editor.x=63
13
+package.editor.y=132
14
 package.frame.height=600
14
 package.frame.height=600
15
 package.frame.width=800
15
 package.frame.width=800
16
 package.numDependencies=0
16
 package.numDependencies=0