Explorar el Código

Finished Alice and Bob

Nathan Hall hace 6 años
padre
commit
7a0772240a
Se han modificado 4 ficheros con 24 adiciones y 2 borrados
  1. BIN
      Main.class
  2. 5
    0
      Main.ctxt
  3. 17
    0
      Main.java
  4. 2
    2
      package.bluej

BIN
Main.class Ver fichero


+ 5
- 0
Main.ctxt Ver fichero

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=Main
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+numComments=2

+ 17
- 0
Main.java Ver fichero

@@ -1,9 +1,26 @@
1 1
 /**
2 2
  * Created by iyasuwatts on 10/17/17.
3 3
  */
4
+
5
+import java.util.Scanner;
6
+
4 7
 public class Main {
5 8
 
6 9
     public static void main(String[] args ){
10
+        Scanner input = new Scanner(System.in);
11
+        System.out.println("Enter your name.");
12
+        String name = input.next();
13
+        //String name2 = input.next();
14
+
15
+        if(name.equals("Alice")){
16
+            System.out.println("Hi Alice!");
17
+        } else if(name.equals("Bob")){
18
+            System.out.println("Hi Bob!");
19
+        } else {
20
+            System.out.println(name + ", I don't know you!");
21
+        }
22
+        
23
+        //System.out.println("Number 2's name is " + name2);
7 24
 
8 25
     }
9 26
 }

+ 2
- 2
package.bluej Ver fichero

@@ -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=44
13
+package.editor.y=93
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0