Pi

a script I wrote that displays the accurate calculations of a circle.

repeat
	(display dialog "Welcome to Pi-O-Lator v 1.2!
What would you like to solve for?


" buttons {"Diameter", "Radius", "Quit"} default button 3)
	if button returned of the result is "Diameter" then
		set d to text returned of ¬
			(display dialog "Punch in the diameter:" default answer "")
		display dialog " diameter: " & d & "
	
	radius: " & d / 2 & "
	
	area: " & (d / 2 * pi) * (d / 2 * pi) & "
	
	circumference: " & 3 * pi * d / 2
	else if button returned of the result is "Radius" then
		set r to text returned of ¬
			(display dialog "Punch in the radius:" default answer "")
		
		display dialog " radius: " & r & "
	
	diameter: " & r * 2 & "
	
	area: " & (r * pi) * (r * pi) & "
	
	circumference: " & 3 * pi * r
	end if
	
	(display dialog "Anything else I can do for you?" buttons {"No", "Yes"} default button 2 giving up after 30)
	if the button returned of the result is "No" then
		exit repeat
	end if
end repeat
display dialog "Copyright © 2004-2005 Alexander Deich" giving up after 1

Hi, code_monkey.

The formulae for calculating the circumference and area of a circle, translated into AppleScript and using its built-in ‘pi’ constant, are:

oops… typo