In this project, we're going to make an application with which the user can quickly calculate the area (and perimeter) of the shapes we program. We will use functions! Functions are extremely important in all programming languages!
2) Create a text sprite. This is where the answer to the calculation will be.
3) Now, when a user clicks on the circle, ask the user to input a radius length and place the number that they input into the text sprite you created in Step 2.
4) Create a function (see More Blocks in documentation) that returns the area of a circle given a radius of that circle. Use that function and the user input to calculate the area of the circle and put the result in the display window. Be sure that the math of your program returns the correct result.
5) Use a JavaScript function to limit the result to 2 decimal points (search the internet to find a JavaScript function that does this).
6) Replace the single number result with more descriptive text that still includes the correct answer.
Play this demo in full screen.
7) (challenge) If a user inputs a non-number, make your program ask the user for a number again or display an error.
8) (challenge) Ask the user if they want to calculate the area or perimeter of the circle when they click on it. Change what your program does depending upon their answer.