@@ -24,15 +24,15 @@ class Fraction private constructor(
24
24
operator fun plus (other : Fraction ): Fraction = TODO ()
25
25
26
26
// TODO: "fraction+number" operator
27
- operator fun plus (other : Number ): Fraction = TODO ()
27
+ operator fun plus (other : Int ): Fraction = TODO ()
28
28
// endregion
29
29
30
30
// region times operators
31
31
// TODO: "fraction*fraction" operator
32
32
operator fun times (other : Fraction ): Fraction = TODO ()
33
33
34
34
// TODO: "fraction*number" operator
35
- operator fun times (number : Number ): Fraction = TODO ()
35
+ operator fun times (number : Int ): Fraction = TODO ()
36
36
// endregion
37
37
38
38
// TODO: Compare two fractions
@@ -56,12 +56,6 @@ class Fraction private constructor(
56
56
// endregion
57
57
58
58
companion object {
59
- @JvmStatic
60
- fun ofDouble (decimal : Double ): Fraction {
61
- // TODO: Returns a fraction from a decimal number
62
- return Fraction (0 , 0 ) // Change this
63
- }
64
-
65
59
@JvmStatic
66
60
fun ofInt (number : Int ): Fraction {
67
61
// TODO: Returns a fraction from an integer number
@@ -113,7 +107,6 @@ fun main() {
113
107
// Creation
114
108
println (" 1/2: ${Fraction .of(1 , 2 )} " )
115
109
println (" 2/3: ${Fraction .of(2 , 3 )} " )
116
- println (" 1.6: ${Fraction .ofDouble(1.6 )} " )
117
110
println (" 8: ${Fraction .ofInt(8 )} " )
118
111
println (" 2/4: ${2 over 4 } " )
119
112
0 commit comments