Created
July 26, 2008 01:00
-
-
Save jiphex/2569 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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