Skip to content

Instantly share code, notes, and snippets.

@russ
Created September 26, 2011 21:06
Show Gist options
  • Save russ/1243409 to your computer and use it in GitHub Desktop.
Save russ/1243409 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "rubygems"
require "highline/import"
interval = ask("What time interval?", Integer) { |q| q.default = 15 }
amount = ask("What is the charge?", Integer) { |q| q.default = 1 }
capacity = ask("What is the capacity?", Integer) { |q| q.default = 15 }
average_hours_per_day = ask("Average number of hours per day?", Integer) { |q| q.default = 7 }
per_hour = (amount * interval) * capacity
per_day = per_hour * average_hours_per_day
per_month = per_day * 30
per_year = per_month * 12
puts "Per Hour:\t $#{per_hour.to_s}"
puts "Per Day:\t $#{per_day}"
puts "Per Month:\t $#{per_month}"
puts "Per Year:\t $#{per_year}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment