themactep.com

A home of miscellaneous projects by Paul Philippov.

Notes

How to detemine the concentration of washing detergent

#!/usr/bin/ruby
#
# Washing detergent concentration calculator
# Paul Philippov <paul@themactep.com>
# 2022+050@912
#

if ARGV.length < 2
  puts "Usage: #{__FILE__} <volume in oz> <number of loads>"
  exit 1
end

oz = ARGV[0].to_f
dz = ARGV[1].to_f

case oz / dz
when 2.5...   then puts "1X"
when 1.5..2.5 then puts "2X"
when 0.7..0.9 then puts "3X"
when 0.5..0.7 then puts "4X"
when 0.3..0.5 then puts "5X"
when 0.2..0.3 then puts "6X"
else               puts "6X+"
end