Mexi Liang 6 年之前
父節點
當前提交
4b439ec247
共有 7 個文件被更改,包括 160 次插入21 次删除
  1. 二進制
      .DS_Store
  2. 二進制
      ConversionTool.class
  3. 21
    0
      ConversionTool.ctxt
  4. 84
    9
      ConversionTool.java
  5. 二進制
      ConversionToolSpec.class
  6. 43
    0
      ConversionToolSpec.ctxt
  7. 12
    12
      package.bluej

二進制
.DS_Store 查看文件


二進制
ConversionTool.class 查看文件


+ 21
- 0
ConversionTool.ctxt 查看文件

@@ -0,0 +1,21 @@
1
+#BlueJ class context
2
+comment0.target=ConversionTool
3
+comment1.params=args
4
+comment1.target=void\ main(java.lang.String[])
5
+comment2.params=centimeters
6
+comment2.target=float\ CentimetersToInches(float)
7
+comment3.params=inches
8
+comment3.target=float\ InchesToCentimeters(float)
9
+comment4.params=feet
10
+comment4.target=float\ FeetToMeters(float)
11
+comment5.params=meters
12
+comment5.target=float\ MetersToFeet(float)
13
+comment6.params=celsius
14
+comment6.target=float\ CelsiusToFahrenheit(float)
15
+comment7.params=fahrenheit
16
+comment7.target=float\ FahrenheitToCelsius(float)
17
+comment8.params=mph
18
+comment8.target=float\ MphToKph(float)
19
+comment9.params=kph
20
+comment9.target=float\ KphToMph(float)
21
+numComments=10

+ 84
- 9
ConversionTool.java 查看文件

@@ -1,21 +1,96 @@
1 1
 public class ConversionTool {
2 2
 
3
-
4 3
     public static void main(String[] args){}
5 4
 
6
-    public static float CentimetersToInches(float centimeters){}
5
+    public static float CentimetersToInches(float centimeters){
6
+        float value =0;
7
+        if (centimeters > 0){
8
+            float n = centimeters * 0.393701f;
9
+            value = n;
10
+            return value;
11
+        }
12
+        else{
13
+        }
14
+        return 0;
15
+    }
16
+
17
+    public static float InchesToCentimeters(float inches){
18
+        float value = 0;
19
+        if (inches > 0){
20
+            float n = inches * 2.54f;
21
+            value = n;
22
+            return value;}
23
+        else{
24
+        }
25
+        return 0;
26
+
27
+    }
28
+
29
+    public static float FeetToMeters(float feet){
30
+        float value =0;
31
+        if (feet > 0){
32
+            float n = feet *0.3048f;
33
+            value = n;
34
+            return value;
35
+        }
36
+        else{
37
+        }
38
+        return 0;
39
+    }
40
+
41
+    public static float MetersToFeet(float meters){
42
+        float value = 0;
43
+        if (meters > 0){
44
+            float n = meters * 3.28084f;
45
+            value = n;
46
+            return value;
47
+        }
48
+        else{
49
+        }
50
+        return 0;
51
+    }
7 52
 
8
-    public static float InchesToCentimeters(float inches){}
53
+    public static float CelsiusToFahrenheit(float celsius){
54
+        float value =0;
55
+        if (celsius == 0){
56
+            float n = 32;
57
+        }
58
+        if (celsius !=0){
59
+            float n = celsius *1.8f + 32f;
60
+            value = n;
61
+        }
62
+        return Math.round(value);
63
+    }
9 64
 
10
-    public static float FeetToMeters(float feet){}
65
+    public static float FahrenheitToCelsius(float fahrenheit){
11 66
 
12
-    public static float MetersToFeet(float meters){}
67
+        float value = (fahrenheit - 32) * (5/9f);
13 68
 
14
-    public static float CelsiusToFahrenheit(float celsius){}
69
+        return value;
70
+    }
15 71
 
16
-    public static float FahrenheitToCelsius(float fahrenheit){}
72
+    public static float MphToKph(float mph){
73
+        float value =0;
74
+        if (mph > 0){
75
+            float n = mph * 1.60934f;
76
+            value = n;
77
+            return value;
78
+        }
79
+        else{
80
+        }
81
+        return 0;
17 82
 
18
-    public static float MphToKph(float mph){}
83
+    }
19 84
 
20
-    public static float KphToMph(float kph){}
85
+    public static float KphToMph(float kph){
86
+        float value =0;
87
+        if (kph > 0){
88
+            float n = kph * 0.621371f;
89
+            value = n;
90
+            return value;
91
+        }
92
+        else {
93
+        }
94
+        return 0;
95
+    }
21 96
 }

二進制
ConversionToolSpec.class 查看文件


+ 43
- 0
ConversionToolSpec.ctxt 查看文件

@@ -0,0 +1,43 @@
1
+#BlueJ class context
2
+comment0.target=ConversionToolSpec
3
+comment1.params=
4
+comment1.target=void\ shouldConvertCentimetersToInches()
5
+comment10.params=
6
+comment10.target=void\ shouldConvertMetersToFeet()
7
+comment11.params=
8
+comment11.target=void\ shouldConvertZeroMetersToZeroFeet()
9
+comment12.params=
10
+comment12.target=void\ shouldConvertNegativeMetersToZeroFeet()
11
+comment13.params=
12
+comment13.target=void\ shouldConvertFahrenheitToCelsius()
13
+comment14.params=
14
+comment14.target=void\ shouldConvertCelsiusToFahrenheit()
15
+comment15.params=
16
+comment15.target=void\ shouldConvertMphToKph()
17
+comment16.params=
18
+comment16.target=void\ shouldConvertZeroMphToZeroKph()
19
+comment17.params=
20
+comment17.target=void\ shouldConvertNegativeMphToZeroKph()
21
+comment18.params=
22
+comment18.target=void\ shouldConvertKphToMph()
23
+comment19.params=
24
+comment19.target=void\ shouldConvertZeroKphToZeroMph()
25
+comment2.params=
26
+comment2.target=void\ shouldConvertZeroCentimetersToZeroInches()
27
+comment20.params=
28
+comment20.target=void\ shouldConvertNegativeKphToZeroMph()
29
+comment3.params=
30
+comment3.target=void\ shouldConvertNegativeCentimetersToZeroInches()
31
+comment4.params=
32
+comment4.target=void\ shouldConvertInchesToCentimeters()
33
+comment5.params=
34
+comment5.target=void\ shouldConvertZeroInchesToZeroCentimeters()
35
+comment6.params=
36
+comment6.target=void\ shouldConvertNegativeInchesToZeroCentimeters()
37
+comment7.params=
38
+comment7.target=void\ shouldConvertFeetToMeters()
39
+comment8.params=
40
+comment8.target=void\ shouldConvertZeroFeetToZeroMeters()
41
+comment9.params=
42
+comment9.target=void\ shouldConvertNegativeFeetToZeroMeters()
43
+numComments=21

+ 12
- 12
package.bluej 查看文件

@@ -2,18 +2,18 @@
2 2
 dependency1.from=ConversionToolSpec
3 3
 dependency1.to=ConversionTool
4 4
 dependency1.type=UsesDependency
5
-editor.fx.0.height=722
6
-editor.fx.0.width=800
7
-editor.fx.0.x=320
8
-editor.fx.0.y=75
9
-objectbench.height=164
5
+editor.fx.0.height=709
6
+editor.fx.0.width=1157
7
+editor.fx.0.x=10
8
+editor.fx.0.y=42
9
+objectbench.height=165
10 10
 objectbench.width=776
11 11
 package.divider.horizontal=0.6
12
-package.divider.vertical=0.6845018450184502
13
-package.editor.height=364
14
-package.editor.width=674
12
+package.divider.vertical=0.6826568265682657
13
+package.editor.height=363
14
+package.editor.width=675
15 15
 package.editor.x=419
16
-package.editor.y=221
16
+package.editor.y=130
17 17
 package.frame.height=600
18 18
 package.frame.width=800
19 19
 package.numDependencies=1
@@ -29,14 +29,14 @@ readme.y=10
29 29
 target1.height=50
30 30
 target1.name=ConversionToolSpec
31 31
 target1.showInterface=false
32
-target1.type=ClassTarget
33
-target1.width=150
32
+target1.type=UnitTestTargetJunit4
33
+target1.width=160
34 34
 target1.x=130
35 35
 target1.y=10
36 36
 target2.height=50
37 37
 target2.name=ConversionTool
38 38
 target2.showInterface=false
39 39
 target2.type=ClassTarget
40
-target2.width=120
40
+target2.width=130
41 41
 target2.x=250
42 42
 target2.y=110