Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function calculateBallast (carMass, carPower, percent)
- powerWeightRatio = carMass/carPower
- newPowerWeightRatio = powerWeightRatio * (1+(percent/100))
- newCarMass = newPowerWeightRatio * carPower
- ballast = newCarMass - carMass
- return math.floor(ballast)
- end
- io.write ("Ballast table for LX4 \n")
- for i=5,1,-1 do
- io.write(i,"% -> ", calculateBallast (499 ,140, i), " kg\n")
- end
- io.write ("Ballast table for RAC \n")
- for i=10,1,-1 do
- io.write(i,"% -> ",calculateBallast (800 ,245 , i), "kg\n")
- end
- io.write ("Ballast table for LX6 \n")
- for i=15,1,-1 do
- io.write(i,"% -> ",calculateBallast (539 ,190 , i), "kg\n")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement