浏览代码

This is the completed Lab

De'Jon Johnson 6 年前
父节点
当前提交
d96833a82a
共有 3 个文件被更改,包括 22 次插入1 次删除
  1. 二进制
      Main.class
  2. 5
    0
      Main.ctxt
  3. 17
    1
      Main.java

二进制
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

+ 17
- 1
Main.java 查看文件

@@ -1,9 +1,25 @@
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
+        Scanner response = new Scanner(System.in);
9
+        
10
+        System.out.println("What's your name? ");
11
+        for(int i=0; i<5;i++){
12
+        String RespondersName = response.nextLine();
13
+        
14
+        if (RespondersName.equals("Bob")  || RespondersName.equals("bob") ||RespondersName.equals("BOB")) {
15
+            System.out.println("Greetings " + RespondersName);
16
+             //break;
17
+        } else if (RespondersName.equals("alice") || RespondersName.equals("Alice") || RespondersName.equals("ALICE")){
18
+          System.out.println("Greetings " + RespondersName);
19
+             //break;
20
+        } else {
21
+        System.out.println("Your name is not Alice or Bob");
22
+       }
23
+    }
8 24
     }
9 25
 }