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
8 changes: 7 additions & 1 deletion src/main/kotlin/mate/academy/NumberTransformation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ package mate.academy
If the number is not present return null
*/

private const val MULTIPLIER = 3
private const val ADDEND = 10
private const val DIVISOR = 11

fun getReminder(numberStr: String?) : Int? {
return null
return numberStr?.toIntOrNull()?.let { number ->
(number * MULTIPLIER + ADDEND) % DIVISOR
}
}
6 changes: 5 additions & 1 deletion src/main/kotlin/mate/academy/TotalPrice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ 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
*/

private const val DEFAULT_PRICE = 29.99

fun calculateTotalPrice(pricePerProduct: Double?, count: Int) : Double {
return 0.0
val price = pricePerProduct ?: DEFAULT_PRICE
return price * count
}
Loading