[BAEL-8472] - Fixed compile issues in kollin libraries
This commit is contained in:
parent
3ce0294470
commit
f3e7182257
@ -0,0 +1,17 @@
|
|||||||
|
package com.baeldung.kotlin.junit5
|
||||||
|
|
||||||
|
class Calculator {
|
||||||
|
fun add(a: Int, b: Int) = a + b
|
||||||
|
|
||||||
|
fun divide(a: Int, b: Int) = if (b == 0) {
|
||||||
|
throw DivideByZeroException(a)
|
||||||
|
} else {
|
||||||
|
a / b
|
||||||
|
}
|
||||||
|
|
||||||
|
fun square(a: Int) = a * a
|
||||||
|
|
||||||
|
fun squareRoot(a: Int) = Math.sqrt(a.toDouble())
|
||||||
|
|
||||||
|
fun log(base: Int, value: Int) = Math.log(value.toDouble()) / Math.log(base.toDouble())
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
package com.baeldung.kotlin.junit5
|
||||||
|
|
||||||
|
class DivideByZeroException(val numerator: Int) : Exception()
|
Loading…
x
Reference in New Issue
Block a user