Selaa lähdekoodia

temporary calculator

Jared Norris 6 vuotta sitten
vanhempi
commit
96cfa058e8
6 muutettua tiedostoa jossa 70 lisäystä ja 31 poistoa
  1. BIN
      ShortCalculator.class
  2. 13
    1
      ShortCalculator.ctxt
  3. 24
    0
      ShortCalculator.java
  4. BIN
      ShortCalculatorTest.class
  5. 4
    1
      ShortCalculatorTest.java
  6. 29
    29
      package.bluej

BIN
ShortCalculator.class Näytä tiedosto


+ 13
- 1
ShortCalculator.ctxt Näytä tiedosto

@@ -1,3 +1,15 @@
1 1
 #BlueJ class context
2 2
 comment0.target=ShortCalculator
3
-numComments=1
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+comment2.params=x\ y
6
+comment2.target=short\ sum(short,\ short)
7
+comment3.params=x\ y
8
+comment3.target=short\ difference(short,\ short)
9
+comment4.params=x\ y
10
+comment4.target=short\ remainder(short,\ short)
11
+comment5.params=x\ y
12
+comment5.target=short\ product(short,\ short)
13
+comment6.params=x\ y
14
+comment6.target=short\ quotient(short,\ short)
15
+numComments=7

+ 24
- 0
ShortCalculator.java Näytä tiedosto

@@ -2,4 +2,28 @@
2 2
 
3 3
 
4 4
 public class ShortCalculator {
5
+    public static void main(String[] args) {
6
+        short x = 12121;
7
+        short y = 21212;
8
+        System.out.println("Sum = " + sum(x, y));
9
+        System.out.println("Difference = " + difference(x, y));
10
+        System.out.println("Remainder = " + remainder(x, y));
11
+        System.out.println("Product = " + product(x, y));
12
+        System.out.println("Quotient = " + quotient(x, y));
13
+    }
14
+    public static short sum(short x, short y) {
15
+        return (short)(x + y);
16
+    }
17
+    public static short difference(short x, short y) {
18
+        return (short)(x - y);
19
+    }
20
+    public static short remainder(short x, short y) {
21
+        return (short)(x % y);
22
+    }
23
+    public static short product(short x, short y) {
24
+        return (short)(x * y);
25
+    }
26
+    public static short quotient(short x, short y) {
27
+        return (short)(x / y);
28
+    }  
5 29
 }

BIN
ShortCalculatorTest.class Näytä tiedosto


+ 4
- 1
ShortCalculatorTest.java Näytä tiedosto

@@ -1,5 +1,8 @@
1
- 
1
+import org.junit.Assert;
2
+import org.junit.Before;
3
+import org.junit.Test;
2 4
 
3 5
 
4 6
 public class ShortCalculatorTest {
7
+
5 8
 }

+ 29
- 29
package.bluej Näytä tiedosto

@@ -11,19 +11,19 @@ dependency3.type=UsesDependency
11 11
 dependency4.from=IntegerPrinterTest
12 12
 dependency4.to=IntegerPrinter
13 13
 dependency4.type=UsesDependency
14
-editor.fx.0.height=0
15
-editor.fx.0.width=0
16
-editor.fx.0.x=0
17
-editor.fx.0.y=0
18
-objectbench.height=101
14
+editor.fx.0.height=714
15
+editor.fx.0.width=800
16
+editor.fx.0.x=47
17
+editor.fx.0.y=23
18
+objectbench.height=99
19 19
 objectbench.width=1070
20 20
 package.divider.horizontal=0.6
21
-package.divider.vertical=0.837593984962406
22
-package.editor.height=550
21
+package.divider.vertical=0.8384146341463414
22
+package.editor.height=543
23 23
 package.editor.width=968
24 24
 package.editor.x=59
25
-package.editor.y=82
26
-package.frame.height=723
25
+package.editor.y=23
26
+package.frame.height=714
27 27
 package.frame.width=1094
28 28
 package.numDependencies=4
29 29
 package.numTargets=10
@@ -40,68 +40,68 @@ target1.name=Factorial
40 40
 target1.showInterface=false
41 41
 target1.type=ClassTarget
42 42
 target1.width=80
43
-target1.x=160
44
-target1.y=10
43
+target1.x=740
44
+target1.y=100
45 45
 target10.height=50
46 46
 target10.name=IntegerPrinterTest
47 47
 target10.showInterface=false
48 48
 target10.type=UnitTestTargetJunit4
49 49
 target10.width=140
50
-target10.x=10
51
-target10.y=370
50
+target10.x=740
51
+target10.y=270
52 52
 target2.height=50
53 53
 target2.name=NormalizeAngle
54 54
 target2.showInterface=false
55 55
 target2.type=ClassTarget
56 56
 target2.width=120
57
-target2.x=70
58
-target2.y=70
57
+target2.x=760
58
+target2.y=380
59 59
 target3.height=50
60 60
 target3.name=IntegerPrinter
61 61
 target3.showInterface=false
62 62
 target3.type=ClassTarget
63 63
 target3.width=110
64
-target3.x=10
65
-target3.y=130
64
+target3.x=730
65
+target3.y=190
66 66
 target4.height=50
67 67
 target4.name=ShortCalculator
68 68
 target4.showInterface=false
69 69
 target4.type=ClassTarget
70 70
 target4.width=120
71
-target4.x=130
72
-target4.y=130
71
+target4.x=530
72
+target4.y=30
73 73
 target5.height=50
74 74
 target5.name=LargestInteger
75 75
 target5.showInterface=false
76 76
 target5.type=ClassTarget
77 77
 target5.width=120
78
-target5.x=10
79
-target5.y=190
78
+target5.x=580
79
+target5.y=450
80 80
 target6.height=50
81 81
 target6.name=LargestIntegerTest
82 82
 target6.showInterface=false
83 83
 target6.type=UnitTestTargetJunit4
84 84
 target6.width=140
85
-target6.x=250
86
-target6.y=190
85
+target6.x=560
86
+target6.y=390
87 87
 target7.height=50
88 88
 target7.name=ShortCalculatorTest
89 89
 target7.showInterface=false
90 90
 target7.type=ClassTarget
91 91
 target7.width=150
92
-target7.x=10
93
-target7.y=250
92
+target7.x=510
93
+target7.y=100
94 94
 target8.height=50
95 95
 target8.name=NormalizeAngleTest
96 96
 target8.showInterface=false
97 97
 target8.type=UnitTestTargetJunit4
98 98
 target8.width=150
99
-target8.x=10
100
-target8.y=310
99
+target8.x=740
100
+target8.y=450
101 101
 target9.height=50
102 102
 target9.name=FactorialTest
103 103
 target9.showInterface=false
104 104
 target9.type=UnitTestTargetJunit4
105 105
 target9.width=110
106
-target9.x=410
107
-target9.y=260
106
+target9.x=710
107
+target9.y=20