Explorar el Código

Created a greeting program that greets the user if their name is Alice or Bob, if not tthe user is told to go away

Saurav Kamath hace 6 años
padre
commit
4d80825b77
Se han modificado 6 ficheros con 27 adiciones y 7 borrados
  1. BIN
      .DS_Store
  2. BIN
      Main.class
  3. 5
    0
      Main.ctxt
  4. 11
    1
      Main.java
  5. 5
    0
      Main.txt
  6. 6
    6
      package.bluej

BIN
.DS_Store Ver fichero


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

+ 11
- 1
Main.java Ver fichero

@@ -1,9 +1,19 @@
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 ){
7
-
8
+        System.out.println("Please Print Your Name");
9
+        Scanner input = new Scanner(System.in);
10
+        String name = input.nextLine();
11
+        
12
+        if(name.equals("Alice") || name.equals("Bob")){
13
+            System.out.println("Greetings " + name);
14
+        
15
+        }else{
16
+            System.out.println("Go Away " + name);
17
+        }
8 18
     }
9 19
 }

+ 5
- 0
Main.txt 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

+ 6
- 6
package.bluej Ver fichero

@@ -1,16 +1,16 @@
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=714
3
+editor.fx.0.width=800
4
+editor.fx.0.x=240
5
+editor.fx.0.y=23
6 6
 objectbench.height=101
7 7
 objectbench.width=776
8 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=402
13
+package.editor.y=135
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0