nafis nibir 6 년 전
부모
커밋
507b768ae4
6개의 변경된 파일116개의 추가작업 그리고 17개의 파일을 삭제
  1. BIN
      ConversionTool.class
  2. 23
    0
      ConversionTool.ctxt
  3. 50
    17
      ConversionTool.java
  4. BIN
      ConversionToolSpec.class
  5. 43
    0
      ConversionToolSpec.ctxt
  6. 0
    0
      README.TXT

BIN
ConversionTool.class 파일 보기


+ 23
- 0
ConversionTool.ctxt 파일 보기

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

+ 50
- 17
ConversionTool.java 파일 보기

@@ -1,21 +1,54 @@
1 1
 public class ConversionTool {
2
-
3
-
2
+    
3
+    private static final float CENT_TO_INCH = (float) 2.54;
4
+    
4 5
     public static void main(String[] args){}
5 6
 
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){}
7
+    public static float CentimetersToInches(float centimeters){
8
+        float inches = centimeters / CENT_TO_INCH;
9
+        return ifNegGetZero(inches);
10
+    }
11
+
12
+    public static float InchesToCentimeters(float inches){
13
+        float centimeters = inches * CENT_TO_INCH;
14
+        return ifNegGetZero(centimeters);
15
+    }
16
+
17
+    public static float FeetToMeters(float feet){
18
+        float meters = feet / (float)3.28;
19
+        return ifNegGetZero(meters);
20
+    }
21
+
22
+    public static float MetersToFeet(float meters){
23
+        float feet = meters * (float)3.2808;
24
+        return ifNegGetZero(feet);
25
+    }
26
+
27
+    public static float CelsiusToFahrenheit(float celsius){
28
+        float fahr = celsius * (float)(1.8) + (float)(32);
29
+        return fahr;
30
+    }
31
+
32
+    public static float FahrenheitToCelsius(float fahrenheit){
33
+        float cels = (fahrenheit - (float)(32)) / (float) (1.8);
34
+        return cels;
35
+    }
36
+
37
+    public static float MphToKph(float mph){
38
+        float kph = mph * (float)(1.60934);
39
+        return ifNegGetZero(kph);
40
+    }
41
+
42
+    public static float KphToMph(float kph){
43
+        float mph = kph / (float)(1.60934);
44
+        return ifNegGetZero(mph);
45
+    }
46
+    
47
+    public static float ifNegGetZero(float number){
48
+        if (number >=0) {
49
+            return number;
50
+        } else {
51
+            return 0;
52
+        }
53
+    }
21 54
 }

BIN
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

+ 0
- 0
README.TXT 파일 보기