Skip to content
Open
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
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
kotlin("jvm") version "1.8.0"
id("org.jetbrains.kotlin.jvm") version "1.8.0"
application
id("io.gitlab.arturbosch.detekt") version "1.23.3"
}
Expand All @@ -20,7 +20,7 @@ tasks.test {
}

kotlin {
jvmToolchain(11)
jvmToolchain(17)
}

detekt {
Expand Down
7 changes: 6 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

rootProject.name = "kt-nullability"

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
9 changes: 7 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,11 @@ package mate.academy
If the number is not present return null
*/

fun getReminder(numberStr: String?) : Int? {
return null
const val TIMES = 3
const val PLUS = 10
const val REM = 11

fun getReminder(numberStr: String?): Int? {
val number = numberStr?.toInt() ?: return null
return number.times(TIMES).plus(PLUS).rem(REM)
}
9 changes: 7 additions & 2 deletions src/main/kotlin/mate/academy/TotalPrice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ package mate.academy
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

const val PRICE = 29.99

fun calculateTotalPrice(pricePerProduct: Double?, count: Int): Double {

val price = pricePerProduct ?: PRICE;
return price * count
}
Loading