Area Calculation App

Hey folks. Its been a while. Anyway, I’m working on a area calculation app as a starter and then plan to make apps for harder math equations (for use in math class).


display dialog "Welcome to the Area Calculation Program!"
display dialog "Please enter length of shape." default answer "" buttons {"Cancel", "Continue"} default button 2
set shape_length to text returned of the result as string
display dialog "Please enter width of shape." default answer "" buttons {"Cancel", "Continue"} default button 2
set shape_width to text returned of the result as string
shape_width * shape_length = shape_area
display dialog (shape_area)

It compiles alright but when I run it and it gets to the part about giving me the answer, it says the variable shape_area is not defined. Can someone help me solve this problem?

Hi,

This statement:

shape_width * shape_length = shape_area

should return a boolean value (true/false) because you’re comparing two values, but shape_area is not defined. You need to define it with ‘set’.

set shape_area to shape_width * shape_length

Also, you probably need to coerce your text entered by the user into numbers.

gl,

worked. Thanks