jpsp91 6 years ago
parent
commit
0ea11d8628
6 changed files with 154 additions and 16 deletions
  1. BIN
      ConversionTool.class
  2. 21
    0
      ConversionTool.ctxt
  3. 82
    8
      ConversionTool.java
  4. BIN
      ConversionToolSpec.class
  5. 43
    0
      ConversionToolSpec.ctxt
  6. 8
    8
      package.bluej

BIN
ConversionTool.class View File


+ 21
- 0
ConversionTool.ctxt View File

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

+ 82
- 8
ConversionTool.java View File

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

BIN
ConversionToolSpec.class View File


+ 43
- 0
ConversionToolSpec.ctxt View File

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

+ 8
- 8
package.bluej View File

@@ -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
5
+editor.fx.0.height=1057
6
+editor.fx.0.width=1920
7
+editor.fx.0.x=-333
8
+editor.fx.0.y=-1057
9 9
 objectbench.height=164
10
-objectbench.width=776
10
+objectbench.width=461
11 11
 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=419
16
-package.editor.y=221
15
+package.editor.x=195
16
+package.editor.y=96
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