Skip to content

Instantly share code, notes, and snippets.

@francois
Forked from juliend2/gist:794918
Created January 25, 2011 14:56
Show Gist options
  • Save francois/795016 to your computer and use it in GitHub Desktop.
Save francois/795016 to your computer and use it in GitHub Desktop.
require "bigdecimal"
montant = BigDecimal.new(ARGV[0])
GSTpercent = 5
QSTpercent = BigDecimal.new("8.5")
myGST = montant * GSTpercent / 100
myQST = (montant + myGST) * QSTpercent / 100
total = montant + myGST + myQST
printf "Sous-total:\t%.2f\n", montant
printf "TPS (%.2f%%):\t%.2f\n", GSTpercent, myGST
printf "TVQ (%.2f%%):\t%.2f\n", QSTpercent, myQST
printf "Total:\t%.2f\n", total.round(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment