Sfoglia il codice sorgente

added divide function

Jevit Tith 6 anni fa
parent
commit
ef357364fb
4 ha cambiato i file con 13 aggiunte e 4 eliminazioni
  1. BIN
      Operations.class
  2. 4
    0
      Operations.java
  3. 5
    0
      OperationsTest.java
  4. 4
    4
      package.bluej

BIN
Operations.class Vedi File


+ 4
- 0
Operations.java Vedi File

@@ -30,4 +30,8 @@ public class Operations {
30 30
     public static int multiply(int x, int y) {
31 31
         return x * y;
32 32
     }
33
+    
34
+    public static int divide(int x, int y){
35
+        return (x/y);
36
+    }
33 37
 }

+ 5
- 0
OperationsTest.java Vedi File

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

+ 4
- 4
package.bluej Vedi File

@@ -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=201
8
+editor.fx.0.y=23
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=292
16
+package.editor.y=192
17 17
 package.frame.height=600
18 18
 package.frame.width=800
19 19
 package.numDependencies=1