瀏覽代碼

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 6 年之前
父節點
當前提交
4d80825b77
共有 6 個檔案被更改,包括 27 行新增7 行删除
  1. 二進制
      .DS_Store
  2. 二進制
      Main.class
  3. 5
    0
      Main.ctxt
  4. 11
    1
      Main.java
  5. 5
    0
      Main.txt
  6. 6
    6
      package.bluej

二進制
.DS_Store 查看文件


二進制
Main.class 查看文件


+ 5
- 0
Main.ctxt 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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