Bläddra i källkod

Added divide method and test

Jennifer Tinkler 6 år sedan
förälder
incheckning
ec3aab0930
4 ändrade filer med 15 tillägg och 4 borttagningar
  1. Binär
      Operations.class
  2. 6
    0
      Operations.java
  3. 5
    0
      OperationsTest.java
  4. 4
    4
      package.bluej

Binär
Operations.class Visa fil


+ 6
- 0
Operations.java Visa fil

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

+ 5
- 0
OperationsTest.java Visa fil

@@ -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 testDivision() throws Exception {
22
+        Assert.assertEquals(2, Operations.divide(4, 2));
19 23
 }
24
+}

+ 4
- 4
package.bluej Visa fil

@@ -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=350
8
+editor.fx.0.y=238
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=256
16
+package.editor.y=375
17 17
 package.frame.height=600
18 18
 package.frame.width=800
19 19
 package.numDependencies=1