Bläddra i källkod

completed lab

Tommy Rogers 6 år sedan
förälder
incheckning
7f6ac2b8af
7 ändrade filer med 108 tillägg och 14 borttagningar
  1. Binär
      ConversionTool$metrics.class
  2. Binär
      ConversionTool.class
  3. 3
    0
      ConversionTool.ctxt
  4. 56
    8
      ConversionTool.java
  5. Binär
      ConversionToolSpec.class
  6. 43
    0
      ConversionToolSpec.ctxt
  7. 6
    6
      package.bluej

Binär
ConversionTool$metrics.class Visa fil


Binär
ConversionTool.class Visa fil


+ 3
- 0
ConversionTool.ctxt Visa fil

@@ -0,0 +1,3 @@
1
+#BlueJ class context
2
+comment0.target=ConversionTool
3
+numComments=1

+ 56
- 8
ConversionTool.java Visa fil

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

Binär
ConversionToolSpec.class Visa fil


+ 43
- 0
ConversionToolSpec.ctxt Visa fil

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

+ 6
- 6
package.bluej Visa fil

@@ -5,15 +5,15 @@ dependency1.type=UsesDependency
5 5
 editor.fx.0.height=722
6 6
 editor.fx.0.width=800
7 7
 editor.fx.0.x=320
8
-editor.fx.0.y=75
9
-objectbench.height=164
8
+editor.fx.0.y=36
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
12
+package.divider.vertical=0.6826568265682657
13
+package.editor.height=363
14 14
 package.editor.width=674
15 15
 package.editor.x=419
16
-package.editor.y=221
16
+package.editor.y=158
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