#32 summed up

開啟中
rjsmall90 請求將 2 次程式碼提交從 rjsmall90/ZCW-SumOfInput-BlueJ:master 合併至 master
共有 4 個文件被更改,包括 45 次插入11 次删除
  1. 二進制
      Main.class
  2. 6
    0
      Main.ctxt
  3. 30
    2
      Main.java
  4. 9
    9
      package.bluej

二進制
Main.class 查看文件


+ 6
- 0
Main.ctxt 查看文件

@@ -0,0 +1,6 @@
1
+#BlueJ class context
2
+comment0.target=Main
3
+comment0.text=\n\ Created\ by\ iyasuwatts\ on\ 10/17/17.\n
4
+comment1.params=args
5
+comment1.target=int\ main(int[])
6
+numComments=2

+ 30
- 2
Main.java 查看文件

@@ -1,9 +1,37 @@
1
+import java.util.Scanner;
2
+
1 3
 /**
2 4
  * Created by iyasuwatts on 10/17/17.
3 5
  */
4 6
 public class Main {
5 7
 
6
-    public static void main(String[] args){
8
+    //public String [] sort(String[] n){
7 9
 
8
-    }
10
+    //}
11
+    //public int addItUp(int n)
12
+    
13
+public int main(int [] args){
14
+    System.out.println("Enter a number: ");
15
+    Scanner input = new Scanner(System.in);
16
+    int number = input.nextInt();
17
+    int sum=0;
18
+    for(int element: args){
19
+        sum+=element;}
20
+    
21
+    System.out.println("Your Total is: "+sum);
22
+    return 0;
9 23
 }
24
+    }
25
+
26
+    /*public int sumOf(int [] number){
27
+        int y = input.nextInt();
28
+        int sum=0;
29
+        //step 2 loop through numbers in array 
30
+        for(int element: number){
31
+            sum+=element;
32
+        }
33
+      
34
+        return sum;
35
+    }*/
36
+
37
+

+ 9
- 9
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=722
3
+editor.fx.0.width=800
4
+editor.fx.0.x=395
5
+editor.fx.0.y=30
6 6
 objectbench.height=164
7
-objectbench.width=776
7
+objectbench.width=461
8 8
 package.divider.horizontal=0.6
9 9
 package.divider.vertical=0.6845018450184502
10 10
 package.editor.height=364
11 11
 package.editor.width=674
12
-package.editor.x=-816
13
-package.editor.y=445
12
+package.editor.x=100
13
+package.editor.y=100
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=180
32
+target1.y=130