Skip to content

Instantly share code, notes, and snippets.

@jiphex
Created July 26, 2008 01:00
Show Gist options
  • Save jiphex/2569 to your computer and use it in GitHub Desktop.
Save jiphex/2569 to your computer and use it in GitHub Desktop.
BWPRICE = 0.045
COLPRICE = 0.12
unless ARGV[0] then
puts "Usage: #{$0} [#bwpages] [#colpages] [#copies] [binding-price/copy]"
exit 1
end
binding_price = ARGV[3].to_f
bwpages = ARGV[0].to_i
colpages = ARGV[1].to_i
copies = ARGV[2] || 1
copies = copies.to_i
price = ((bwpages * BWPRICE) + (colpages * COLPRICE) + binding_price) * copies
puts "Printing cost: %.2f\n\t(%d bw + %d color pages * #{copies} copies + binding price/copy of %.2f)" % [price, bwpages, colpages, binding_price]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment