lm-sistemi-software-distrib.../src/main/kotlin/drills/drill02/exercise3/Main.kt

16 lines
371 B
Kotlin

package drills.drill02.exercise3
fun main() {
val factory = MathFactory()
val math = factory.create()
val mathLog = factory.create(logger = true)
println("Enter two numbers:")
val a = readLine()?.toFloat() ?: 0f
val b = readLine()?.toFloat() ?: 0f
println("The sum is ${math.add(a, b)}.")
println("The sum is ${mathLog.add(a, b)}.")
}