瀏覽代碼

added prompt for name as well as name to welcome message

Jonathan Hinds 6 年之前
父節點
當前提交
7e11bf8a8e
共有 3 個檔案被更改,包括 7 行新增6 行删除
  1. 二進制
      Main.class
  2. 3
    2
      Main.java
  3. 4
    4
      package.bluej

二進制
Main.class 查看文件


+ 3
- 2
Main.java 查看文件

@@ -10,13 +10,14 @@ public class Main {
10 10
     }
11 11
     
12 12
     public static void Welcome(){
13
+        System.out.println("Please enter your name");
14
+        
13 15
         Scanner scanner = new Scanner(System.in);
14 16
         String userInput = scanner.next();
15 17
 
16
-        //System.out.println(userInput);
17 18
         if(userInput.equalsIgnoreCase("alice") || userInput.equalsIgnoreCase("bob"))
18 19
         {
19
-            System.out.println("Welcome");
20
+            System.out.println("Welcome " + userInput);
20 21
         }
21 22
     }
22 23
 }

+ 4
- 4
package.bluej 查看文件

@@ -1,8 +1,8 @@
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=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=240
5
+editor.fx.0.y=24
6 6
 objectbench.height=101
7 7
 objectbench.width=776
8 8
 package.divider.horizontal=0.6