Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Currency/Kotlin/currency.kotlin
Normal file
19
Task/Currency/Kotlin/currency.kotlin
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// version 1.1.2
|
||||
|
||||
import java.math.BigDecimal
|
||||
import java.math.MathContext
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val mc = MathContext.DECIMAL128
|
||||
val nHamburger = BigDecimal("4000000000000000", mc)
|
||||
val pHamburger = BigDecimal("5.50")
|
||||
val nMilkshakes = BigDecimal("2", mc)
|
||||
val pMilkshakes = BigDecimal("2.86")
|
||||
val taxRate = BigDecimal("0.0765")
|
||||
val price = nHamburger * pHamburger + nMilkshakes * pMilkshakes
|
||||
val tax = price * taxRate
|
||||
val fmt = "%20.2f"
|
||||
println("Total price before tax : ${fmt.format(price)}")
|
||||
println("Tax thereon @ 7.65% : ${fmt.format(tax)}")
|
||||
println("Total price after tax : ${fmt.format(price + tax)}")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue