I will periodically post coding challenges to be solved with LiveCode.
Solving problems is a great way to improve your coding skills.
Vote for the best answer.
please paste plain text only.
please add [code] at the beginning of your code, and [/code] at the end to facilitate syntax colorizing.
if you see that ‘AndyP edited….’ your answer, this will be only for formatting.. I will not be changing your answer.
This is a two part puzzle.
Part 1 is to produce a formula and to provide the solution for part 1.
Part 1: Given a ball with a circumference of 1200 Metres fitted with a rigid band that circles the balls circumference and is in contact with the ball at all points, what would be the distance between the ball and band if the band circumference was increased by 20% ?
Part 2: Code a solution which using graphics that will visually represent the ball and band distance when arbitary values for the band and ball are entered. The balls circumference in Metres and the band as an addition to the balls circumference input as a percentage.
initial band diameter = 1200m
increased band diameter = 1200 * 1.2 = 1440 m
distance between ball and band = (1440 – 1200 ) / 2 = 100 m
set the width of graphic “band” to ((1 + (myInput / 100)) * ( the width of graphic “ball”))
set the loc of graphic “ball” to the loc of graphic “band”[/code]