#37 KennethT867 SumOfInput

Öppen
KennethT867 vill sammanfoga 1 incheckningar från s[2]s in i master
8 ändrade filer med 84 tillägg och 21 borttagningar
  1. Binär
      Main.class
  2. 8
    0
      Main.ctxt
  3. 15
    2
      Main.java
  4. Binär
      MainTest.class
  5. 6
    0
      MainTest.ctxt
  6. 25
    0
      MainTest.java
  7. 0
    0
      README.TXT
  8. 30
    19
      package.bluej

Binär
Main.class Visa fil


+ 8
- 0
Main.ctxt Visa fil

@@ -0,0 +1,8 @@
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=void\ main(java.lang.String[])
6
+comment2.params=input
7
+comment2.target=int\ numberAdding(int)
8
+numComments=3

+ 15
- 2
Main.java Visa fil

@@ -1,9 +1,22 @@
1
+import java.util.*;
1 2
 /**
2 3
  * Created by iyasuwatts on 10/17/17.
3 4
  */
4 5
 public class Main {
5
-
6 6
     public static void main(String[] args){
7
-
7
+    }
8
+    
9
+    public int numberAdding(int input){
10
+        //Scanner in = new Scanner(System.in);
11
+        //System.out.println("Please enter an integer greater than zero.");
12
+        //input = in.nextInt();
13
+        int answer = 0;
14
+        
15
+        
16
+        for(int i = 0; i <= input; i++){
17
+            answer = answer + i;
18
+            
19
+        }
20
+        return answer;
8 21
     }
9 22
 }

Binär
MainTest.class Visa fil


+ 6
- 0
MainTest.ctxt Visa fil

@@ -0,0 +1,6 @@
1
+#BlueJ class context
2
+comment0.target=MainTest
3
+comment0.text=\n\ The\ test\ class\ MainTest.\n\n\ @author\ \ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n
4
+comment1.params=
5
+comment1.target=void\ testMain()
6
+numComments=2

+ 25
- 0
MainTest.java Visa fil

@@ -0,0 +1,25 @@
1
+
2
+
3
+import static org.junit.Assert.*;
4
+import org.junit.After;
5
+import org.junit.Before;
6
+import org.junit.Test;
7
+
8
+/**
9
+ * The test class MainTest.
10
+ *
11
+ * @author  (your name)
12
+ * @version (a version number or a date)
13
+ */
14
+public class MainTest
15
+{
16
+    @Test
17
+    public void testMain(){
18
+        Main main = new Main();
19
+        int input = 3;
20
+        int expected = 6;
21
+        int actual = main.numberAdding(input);
22
+        
23
+        assertEquals(expected, actual);
24
+    }
25
+}

+ 0
- 0
README.TXT Visa fil


+ 30
- 19
package.bluej Visa fil

@@ -1,20 +1,23 @@
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
6
-objectbench.height=164
7
-objectbench.width=776
2
+dependency1.from=MainTest
3
+dependency1.to=Main
4
+dependency1.type=UsesDependency
5
+editor.fx.0.height=583
6
+editor.fx.0.width=816
7
+editor.fx.0.x=464
8
+editor.fx.0.y=22
9
+objectbench.height=66
10
+objectbench.width=739
8 11
 package.divider.horizontal=0.6
9
-package.divider.vertical=0.6845018450184502
10
-package.editor.height=364
11
-package.editor.width=674
12
-package.editor.x=-816
13
-package.editor.y=445
14
-package.frame.height=600
15
-package.frame.width=800
16
-package.numDependencies=0
17
-package.numTargets=1
12
+package.divider.vertical=0.8306264501160093
13
+package.editor.height=351
14
+package.editor.width=653
15
+package.editor.x=434
16
+package.editor.y=22
17
+package.frame.height=489
18
+package.frame.width=779
19
+package.numDependencies=1
20
+package.numTargets=2
18 21
 package.showExtends=true
19 22
 package.showUses=true
20 23
 project.charset=UTF-8
@@ -24,9 +27,17 @@ readme.width=47
24 27
 readme.x=10
25 28
 readme.y=10
26 29
 target1.height=50
27
-target1.name=Main
30
+target1.name=MainTest
28 31
 target1.showInterface=false
29
-target1.type=ClassTarget
32
+target1.type=UnitTestTargetJunit4
30 33
 target1.width=80
31
-target1.x=70
32
-target1.y=10
34
+target1.x=100
35
+target1.y=-20
36
+target2.association=MainTest
37
+target2.height=50
38
+target2.name=Main
39
+target2.showInterface=false
40
+target2.type=ClassTarget
41
+target2.width=80
42
+target2.x=70
43
+target2.y=10