Преглед на файлове

Machine greets Alices and Bobs.

Jennifer Chao преди 6 години
родител
ревизия
3cbe3547bb
променени са 4 файла, в които са добавени 42 реда и са изтрити 9 реда
  1. BIN
      Main.class
  2. 5
    0
      Main.ctxt
  3. 29
    1
      Main.java
  4. 8
    8
      package.bluej

BIN
Main.class Целия файл


+ 5
- 0
Main.ctxt Целия файл

@@ -0,0 +1,5 @@
1
+#BlueJ class context
2
+comment0.target=Main
3
+comment1.params=
4
+comment1.target=void\ verifyIdentity()
5
+numComments=2

+ 29
- 1
Main.java Целия файл

@@ -1,9 +1,37 @@
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
-    public static void main(String[] args ){
9
+    public static void verifyIdentity () 
10
+    {
11
+        Scanner input = new Scanner(System.in);
12
+
13
+        String name;
14
+        System.out.println("What is your first name? ");
15
+        name = input.next();
16
+
17
+        if (name.equalsIgnoreCase("Alice")) {
18
+            System.out.println("Hello, Alice!");
19
+        } else if (name.equalsIgnoreCase("Bob")) {
20
+            System.out.println("Hello, Bob!");
21
+        } else if (name.equalsIgnoreCase("Robert")) {
22
+
23
+            Scanner rob = new Scanner(System.in);
24
+            System.out.println("Do people sometimes call you Bob? ");
25
+            String yas = rob.nextLine();
26
+
27
+            if (yas.equalsIgnoreCase("Yes")) {
28
+                System.out.println("Great! Hello, Bob!");
29
+            } else if (yas.equalsIgnoreCase("No")) {
30
+                System.out.println("Too bad. Bye.");
31
+            } 
7 32
 
33
+        } else {
34
+            System.out.println("You are not welcome here, " + name + ".");
35
+        }
8 36
     }
9 37
 }

+ 8
- 8
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=709
3
+editor.fx.0.width=800
4
+editor.fx.0.x=318
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=480
13
+package.editor.y=23
14 14
 package.frame.height=600
15 15
 package.frame.width=800
16 16
 package.numDependencies=0
@@ -28,5 +28,5 @@ target1.name=Main
28 28
 target1.showInterface=false
29 29
 target1.type=ClassTarget
30 30
 target1.width=80
31
-target1.x=70
32
-target1.y=10
31
+target1.x=120
32
+target1.y=60