puts "Box v0.1"
print "What will we be using to carry the boxes (plane, boat, etc.)? "
vehicle = gets.chomp
print "How many kilograms can the ", vehicle, " support? "
kgs = gets.chomp.to_i
print "How many boxes would you like to put on the ", vehicle, "? "
boxes = gets.chomp.to_i
currentbox = 0
boxesa = [ ]
boxes.times do
print "How much does box number ", currentbox + 1, " weight? "
cboxweight = gets.chomp.to_i
boxesa[currentbox] = cboxweight
currentbox = currentbox + 1
end
abox = 0
bbox = 0
boxesa.each do |boxi|
abox = abox + boxi
end
print "Total box weight is ", abox, " kilograms"
puts ""
print "Weight lift power is ", kgs, " kilograms"
puts ""
conclusion = abox <=> kgs
if conclusion == 0
puts "The cargo will fit just right."
puts ""
elsif conclusion == 1
print "You will need to remove ", abox - kgs, " kilograms for the cargo to be carried"
puts ""
elsif conclusion == -1
print "You can add ", kgs - abox, " kilograms more to your ", vehicle
puts ""
end