Kris Blassingame před 6 roky
rodič
revize
77c03adfbb
5 změnil soubory, kde provedl 121 přidání a 10 odebrání
  1. binární
      ConversionTool.class
  2. 21
    0
      ConversionTool.ctxt
  3. 57
    10
      ConversionTool.java
  4. binární
      ConversionToolSpec.class
  5. 43
    0
      ConversionToolSpec.ctxt

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

+ 57
- 10
ConversionTool.java Zobrazit soubor

@@ -1,21 +1,68 @@
1 1
 public class ConversionTool {
2 2
 
3
+   public static void main(String[] args){}
3 4
 
4
-    public static void main(String[] args){}
5
+   public static float CentimetersToInches(float centimeters){
6
+        float inches = (float)(0.393701 * centimeters);
7
+        if (inches < 0){
8
+            return 0;
9
+        } else{
10
+            return inches;
11
+        }
12
+    }
5 13
 
6
-    public static float CentimetersToInches(float centimeters){}
14
+   public static float InchesToCentimeters(float inches){
15
+        float centimeters = (float) (inches * 2.54);
16
+        if (centimeters < 0){
17
+            return 0;
18
+        } else{
19
+            return centimeters;
20
+        }
21
+    }
7 22
 
8
-    public static float InchesToCentimeters(float inches){}
23
+   public static float FeetToMeters(float feet){
24
+        float meters = (float)(feet * 0.3048);
25
+        if (meters < 0){
26
+            return 0;
27
+        } else{
28
+            return meters;
29
+        }
30
+    }
9 31
 
10
-    public static float FeetToMeters(float feet){}
32
+    public static float MetersToFeet(float meters){
33
+        float feet = (float)(meters * 3.28084);
34
+        if (feet < 0){
35
+            return 0;
36
+        } else{
37
+            return feet;
38
+        }
39
+    }
11 40
 
12
-    public static float MetersToFeet(float meters){}
41
+    public static float CelsiusToFahrenheit(float celsius){
42
+        float f = (int)(celsius * 9/5 + 32);
43
+        return f;
44
+    }
13 45
 
14
-    public static float CelsiusToFahrenheit(float celsius){}
46
+    public static float FahrenheitToCelsius(float fahrenheit){
47
+        float c = (float) ((fahrenheit - 32) / 1.8);
48
+        return c;
49
+    }
15 50
 
16
-    public static float FahrenheitToCelsius(float fahrenheit){}
51
+    public static float MphToKph(float mph){
52
+        float kph = (float)( mph * 1.60934);
53
+        if (kph < 0){
54
+            return 0;
55
+        } else{
56
+            return kph;
57
+        }
58
+    }
17 59
 
18
-    public static float MphToKph(float mph){}
19
-
20
-    public static float KphToMph(float kph){}
60
+    public static float KphToMph(float kph){
61
+        float mph = (float)(kph * 0.621371);
62
+        if (mph < 0){
63
+            return 0;
64
+        } else{
65
+            return mph;
66
+        }
67
+    }
21 68
 }

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