15 lines
628 B
Text
15 lines
628 B
Text
require "bignum"
|
|
local fmt = require "fmt"
|
|
|
|
local hamburgers = bigdec.of("4000000000000000")
|
|
local milkshakes = bigdec.of(2)
|
|
local price1 = bigdec.of(5.5)
|
|
local price2 = bigdec.of(2.86)
|
|
local tax_pc = bigdec.of(0.0765)
|
|
local total_pre_tax = hamburgers * price1 + milkshakes * price2
|
|
local total_tax = tax_pc * total_pre_tax
|
|
local total_after_tax = total_pre_tax + total_tax
|
|
|
|
fmt.print("Total price before tax : %20s", total_pre_tax:tostring(2))
|
|
fmt.print("Tax : %20s", total_tax:tostring(2))
|
|
fmt.print("Total price after tax : %20s", total_after_tax:tostring(2))
|