David Thornley před 6 roky
rodič
revize
5b4581a5c2
6 změnil soubory, kde provedl 122 přidání a 20 odebrání
  1. binární
      ConversionTool.class
  2. 21
    0
      ConversionTool.ctxt
  3. 54
    16
      ConversionTool.java
  4. binární
      ConversionToolSpec.class
  5. 43
    0
      ConversionToolSpec.ctxt
  6. 4
    4
      package.bluej

binární
ConversionTool.class Zobrazit soubor


+ 21
- 0
ConversionTool.ctxt Zobrazit soubor

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

+ 54
- 16
ConversionTool.java Zobrazit soubor

@@ -1,21 +1,59 @@
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){}
7
-
8
-    public static float InchesToCentimeters(float inches){}
9
-
10
-    public static float FeetToMeters(float feet){}
11
-
12
-    public static float MetersToFeet(float meters){}
13
-
14
-    public static float CelsiusToFahrenheit(float celsius){}
15
-
16
-    public static float FahrenheitToCelsius(float fahrenheit){}
17
-
18
-    public static float MphToKph(float mph){}
19
-
20
-    public static float KphToMph(float kph){}
5
+    public static float CentimetersToInches(float centimeters){
6
+        float x = 0;
7
+        if ( centimeters > 0) {
8
+            return x = (float)(centimeters / (2.54));
9
+        } else {return x = 0;}
10
+
11
+    }
12
+
13
+    public static float InchesToCentimeters(float inches){
14
+        float x = 0;
15
+        if ( inches > 0){
16
+            return x = (float)(inches * 2.54);
17
+        } else return x = 0;
18
+    }
19
+
20
+    public static float FeetToMeters(float feet){
21
+        float x = 0;
22
+        if ( feet > 0){
23
+            return x = (float)(feet * 0.3048);
24
+        } else { return x = 0;}
25
+    }
26
+
27
+    public static float MetersToFeet(float meters){
28
+        float x = 0;
29
+        if ( meters > 0) {
30
+            return x = (float)(meters * 3.28084);
31
+        } else  { return x = 0;}
32
+    }
33
+
34
+    public static float CelsiusToFahrenheit(float celsius){
35
+        float x = 0;
36
+
37
+        return x = ((celsius  * 9) / 5) + 32;
38
+    }
39
+
40
+    public static float FahrenheitToCelsius(float fahrenheit){
41
+        float x = 0;
42
+
43
+        return x = (((fahrenheit - 32) * 5) / 9);
44
+    }
45
+
46
+    public static float MphToKph(float mph){
47
+        float x = 0;
48
+        if ( mph > 0) {
49
+            return x = (float)(mph * 1.609344);
50
+        } else { return x = 0;}
51
+    }
52
+
53
+    public static float KphToMph(float kph){
54
+        float x = 0;
55
+        if (kph > 0) {
56
+            return x = (float) (kph * 0.6213711922);
57
+        } else { return x = 0;}
58
+    }
21 59
 }

binární
ConversionToolSpec.class Zobrazit soubor


+ 43
- 0
ConversionToolSpec.ctxt Zobrazit soubor

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

+ 4
- 4
package.bluej Zobrazit soubor

@@ -2,10 +2,10 @@
2 2
 dependency1.from=ConversionToolSpec
3 3
 dependency1.to=ConversionTool
4 4
 dependency1.type=UsesDependency
5
-editor.fx.0.height=722
5
+editor.fx.0.height=713
6 6
 editor.fx.0.width=800
7 7
 editor.fx.0.x=320
8
-editor.fx.0.y=75
8
+editor.fx.0.y=23
9 9
 objectbench.height=164
10 10
 objectbench.width=776
11 11
 package.divider.horizontal=0.6
@@ -13,7 +13,7 @@ package.divider.vertical=0.6845018450184502
13 13
 package.editor.height=364
14 14
 package.editor.width=674
15 15
 package.editor.x=419
16
-package.editor.y=221
16
+package.editor.y=136
17 17
 package.frame.height=600
18 18
 package.frame.width=800
19 19
 package.numDependencies=1
@@ -29,7 +29,7 @@ readme.y=10
29 29
 target1.height=50
30 30
 target1.name=ConversionToolSpec
31 31
 target1.showInterface=false
32
-target1.type=ClassTarget
32
+target1.type=UnitTestTargetJunit4
33 33
 target1.width=150
34 34
 target1.x=130
35 35
 target1.y=10