Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.65 KB | None | 0 0
  1.     function calculateBallast (carMass, carPower, percent)
  2.      powerWeightRatio = carMass/carPower
  3.      newPowerWeightRatio = powerWeightRatio * (1+(percent/100))
  4.      newCarMass = newPowerWeightRatio * carPower
  5.      ballast = newCarMass - carMass
  6.      return math.floor(ballast)
  7.     end
  8.  
  9.  
  10. io.write ("Ballast table for LX4 \n")
  11. for i=5,1,-1 do
  12.   io.write(i,"% -> ", calculateBallast (499 ,140, i),     " kg\n")
  13. end
  14.  
  15. io.write ("Ballast table for RAC \n")
  16. for i=10,1,-1 do
  17.   io.write(i,"% -> ",calculateBallast (800 ,245 , i),     "kg\n")
  18. end
  19.  
  20. io.write ("Ballast table for LX6 \n")
  21. for i=15,1,-1 do
  22.   io.write(i,"% -> ",calculateBallast (539 ,190 , i),     "kg\n")
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement