Skip to content
Open

Alex #149

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tasks.test {
}

kotlin {
jvmToolchain(11)
jvmToolchain(17)
}

detekt {
Expand Down
11 changes: 9 additions & 2 deletions src/main/kotlin/mate/academy/NumberTransformation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ package mate.academy
If the number is not present return null
*/

fun getReminder(numberStr: String?) : Int? {
return null
private const val MULTIPLIER = 3
private const val ADDITION_VALUE = 10
private const val DIVISOR = 11

fun getReminder(numberStr: String?): Int? {
return numberStr?.toInt()
?.times(MULTIPLIER)
?.plus(ADDITION_VALUE)
?.rem(DIVISOR)
}
7 changes: 5 additions & 2 deletions src/main/kotlin/mate/academy/TotalPrice.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package mate.academy

private const val DEFAULT_PRICE_PER_PRODUCT = 29.99

/*
Calculate the products total price based on the provide price per product and products amount.
If the price is not provided, use default price per product equal to 29.99
*/
fun calculateTotalPrice(pricePerProduct: Double?, count: Int) : Double {
return 0.0
fun calculateTotalPrice(pricePerProduct: Double?, count: Int): Double {
val price = pricePerProduct ?: DEFAULT_PRICE_PER_PRODUCT
return price * count
}
Loading