Arin Turpin 6 years ago
parent
commit
2087a3d04d
6 changed files with 31 additions and 1 deletions
  1. BIN
      Operations.class
  2. 14
    0
      Operations.ctxt
  3. 4
    0
      Operations.java
  4. BIN
      OperationsTest.class
  5. 3
    1
      OperationsTest.ctxt
  6. 10
    0
      OperationsTest.java

BIN
Operations.class View File


+ 14
- 0
Operations.ctxt View File

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
+numComments=5

+ 4
- 0
Operations.java View File

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

BIN
OperationsTest.class View File


+ 3
- 1
OperationsTest.ctxt View File

6
 comment2.target=void\ testSubtract()
6
 comment2.target=void\ testSubtract()
7
 comment3.params=
7
 comment3.params=
8
 comment3.target=void\ testMultiply()
8
 comment3.target=void\ testMultiply()
9
-numComments=4
9
+comment4.params=
10
+comment4.target=void\ testDivide()
11
+numComments=5

+ 10
- 0
OperationsTest.java View File

16
     public void testMultiply() throws Exception {
16
     public void testMultiply() throws Exception {
17
         Assert.assertEquals(4, Operations.multiply(2, 2));
17
         Assert.assertEquals(4, Operations.multiply(2, 2));
18
     }
18
     }
19
+    
20
+    @Test
21
+    public void testDivide() throws Exception{
22
+        Operations operations = new Operations();
23
+        int x = 10;
24
+        int y = 2;
25
+        int expected = 5;
26
+        int actual = operations.divide(x,y);
27
+        Assert.assertEquals(expected, actual);
28
+    }
19
 }
29
 }