Bläddra i källkod

Added divide function and unit tests

Nathan Hall 6 år sedan
förälder
incheckning
675340a1ec
7 ändrade filer med 38 tillägg och 2 borttagningar
  1. Binär
      .DS_Store
  2. 9
    0
      Operations
  3. 12
    0
      Operations.ctxt
  4. 6
    0
      Operations.java
  5. Binär
      OperationsTest.class
  6. 9
    0
      OperationsTest.ctxt
  7. 2
    2
      package.bluej

Binär
.DS_Store Visa fil


+ 9
- 0
Operations Visa fil

@@ -0,0 +1,9 @@
1
+public class Operations {
2
+	// The divide function
3
+	
4
+	public static int add(int x, int y){
5
+		return x / y;
6
+	}
7
+
8
+
9
+}

+ 12
- 0
Operations.ctxt Visa fil

@@ -0,0 +1,12 @@
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
+numComments=4

+ 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 Divide Function
35
+    public static int divide(int x, int y){
36
+	return x / y;
37
+    }
38
+
33 39
 }

Binär
OperationsTest.class Visa fil


+ 9
- 0
OperationsTest.ctxt Visa fil

@@ -0,0 +1,9 @@
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
+numComments=4

+ 2
- 2
package.bluej Visa fil

@@ -12,8 +12,8 @@ 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=100
16
+package.editor.y=100
17 17
 package.frame.height=600
18 18
 package.frame.width=800
19 19
 package.numDependencies=1