#39 divide

Otwarty
jbedolla40 chce scalić 1 commity/ów z jbedolla40/CR-Calcul8r:divide do master
7 zmienionych plików z 45 dodań i 5 usunięć
  1. BIN
      Operations.class
  2. 15
    0
      Operations.ctxt
  3. 11
    1
      Operations.java
  4. BIN
      OperationsTest.class
  5. 11
    0
      OperationsTest.ctxt
  6. 4
    0
      OperationsTest.java
  7. 4
    4
      package.bluej

BIN
Operations.class Wyświetl plik


+ 15
- 0
Operations.ctxt Wyświetl plik

@@ -0,0 +1,15 @@
1
+#BlueJ class context
2
+comment0.target=Operations
3
+comment1.params=x\ y
4
+comment1.target=int\ add(int,\ int)
5
+comment1.text=\n\ The\ addition\ function.\n\ @param\ x\ The\ first\ operand\n\ @param\ y\ The\ second\ operand\n\ @return\ the\ sum\ of\ x\ and\ y\n
6
+comment2.params=x\ y
7
+comment2.target=int\ subtract(int,\ int)
8
+comment2.text=\n\ The\ subtraction\ function\n\ @param\ x\ The\ first\ operand\n\ @param\ y\ The\ second\ operand\n\ @return\ y\ taken\ from\ x\n
9
+comment3.params=x\ y
10
+comment3.target=int\ multiply(int,\ int)
11
+comment3.text=\n\ The\ multiplication\ function\n\ @param\ x\ The\ first\ operand\n\ @param\ y\ The\ second\ operand\n\ @return\ x\ times\ y\n
12
+comment4.params=x\ y
13
+comment4.target=int\ divide(int,\ int)
14
+comment4.text=\n\ The\ multiplication\ function\n\ @param\ x\ The\ first\ operand\n\ @param\ y\ The\ second\ operand\n\ @return\ x\ /\ y\n
15
+numComments=5

+ 11
- 1
Operations.java Wyświetl plik

@@ -19,7 +19,7 @@ public class Operations {
19 19
     public static int subtract(int x, int y) {
20 20
         return x - y;
21 21
     }
22
-    
22
+
23 23
 
24 24
     /**
25 25
      * The multiplication function
@@ -30,4 +30,14 @@ public class Operations {
30 30
     public static int multiply(int x, int y) {
31 31
         return x * y;
32 32
     }
33
+    /**
34
+     * The multiplication function
35
+     * @param x The first operand
36
+     * @param y The second operand
37
+     * @return x / y
38
+     */
39
+    public static int divide(int x, int y) {
40
+        return x / y;
41
+    }
42
+
33 43
 }

BIN
OperationsTest.class Wyświetl plik


+ 11
- 0
OperationsTest.ctxt Wyświetl plik

@@ -0,0 +1,11 @@
1
+#BlueJ class context
2
+comment0.target=OperationsTest
3
+comment1.params=
4
+comment1.target=void\ testAdd()
5
+comment2.params=
6
+comment2.target=void\ testSubtract()
7
+comment3.params=
8
+comment3.target=void\ testMultiply()
9
+comment4.params=
10
+comment4.target=void\ testDivide()
11
+numComments=5

+ 4
- 0
OperationsTest.java Wyświetl plik

@@ -16,4 +16,8 @@ public class OperationsTest {
16 16
     public void testMultiply() throws Exception {
17 17
         Assert.assertEquals(4, Operations.multiply(2, 2));
18 18
     }
19
+    @Test
20
+    public void testDivide() throws Exception {
21
+        Assert.assertEquals(1, Operations.divide(2, 2));
22
+    }
19 23
 }

+ 4
- 4
package.bluej Wyświetl plik

@@ -4,16 +4,16 @@ dependency1.to=Operations
4 4
 dependency1.type=UsesDependency
5 5
 editor.fx.0.height=722
6 6
 editor.fx.0.width=800
7
-editor.fx.0.x=320
8
-editor.fx.0.y=75
7
+editor.fx.0.x=2297
8
+editor.fx.0.y=70
9 9
 objectbench.height=164
10 10
 objectbench.width=776
11 11
 package.divider.horizontal=0.6
12 12
 package.divider.vertical=0.6845018450184502
13 13
 package.editor.height=364
14 14
 package.editor.width=674
15
-package.editor.x=-1455
16
-package.editor.y=82
15
+package.editor.x=1547
16
+package.editor.y=166
17 17
 package.frame.height=600
18 18
 package.frame.width=800
19 19
 package.numDependencies=1