浏览代码

added divide function

Jevit Tith 6 年前
父节点
当前提交
ef357364fb
共有 4 个文件被更改,包括 13 次插入4 次删除
  1. 二进制
      Operations.class
  2. 4
    0
      Operations.java
  3. 5
    0
      OperationsTest.java
  4. 4
    4
      package.bluej

二进制
Operations.class 查看文件


+ 4
- 0
Operations.java 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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