Last active
February 13, 2017 18:28
-
-
Save tubbo/f8d5da62eea91f8915cfe287e3e4e51b to your computer and use it in GitHub Desktop.
PERT estimation calculator
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
#!/usr/bin/env ruby | |
# | |
# PERT Calculator v1.0.0 | |
# | |
# To install, place this file in a directory that is in your $PATH. On | |
# my machine, I have ~/bin in my $PATH, so that's where `pert` lives. | |
# | |
# Example: | |
# | |
# $ pert 0.35 0.75 1 | |
# | |
# optimistic: 0.35 | |
# likely: 0.75 | |
# pessimistic: 1.0 | |
# + QA: 0.11 (15%) | |
# FINAL: 0.83 | |
if ARGV.empty? | |
puts "Usage: pert OPTIMISTIC_HOURS LIKELY_HOURS PESSIMISTIC_HOURS" | |
exit 1 | |
end | |
QA_TAX = 0.15 | |
BOOST = 4 | |
QUANTITY = 6 | |
optimistic, likely, pessimistic = ARGV.map(&:to_f) | |
estimate = (optimistic + (BOOST * likely) + pessimistic) / QUANTITY | |
qa_time = estimate * QA_TAX | |
estimate += qa_time | |
[optimistic, likely, pessimistic, estimate, qa_time].map { |num| num.round(2) } | |
puts " optimistic: #{optimistic}" | |
puts " likely: #{likely}" | |
puts "pessimistic: #{pessimistic}" | |
puts " + QA: #{qa_time.round(2)} (#{(QA_TAX * 100).to_i}%)" | |
puts " FINAL: #{estimate.round(2)}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment