Hello all,
I have to design a program that performs the following, and I am stuck on a calculation part:
1. Prompt the user for the number of sides and store this value (numSides)
2. If the number of sides is less than three
a. Output “Sorry, a polygon needs at least three 3 sides!”
Otherwise
b. Compute and store the length of any side of the polygon as
sideLength=(100*360*pi)/(numSides*180)
where you can approximate pi as 3.14159 for this lab
I did all of the above parts and I got the correct display except for part b. I typed the formula in the operator within my if statement but I don't know how to display an answer for a value on the screen (as if the cat is saying the answer)
Everytime I enter a value above 3, it says true but does not show the value of the sideLength.
Any help is appreciated
Offline
Use the say block and simply drag the operator into it. If you have any Boolean blocks in the say block (Booleans are the ones with pointy ends) it will only say true or false, so remove those.
This is all you need:
or this if it's already in the variable:
But NOT this:
(Note the pointy ends)
Last edited by Kileymeister (2011-01-22 22:43:20)
Offline
Kileymeister wrote:
Use the say block and simply drag the operator into it. If you have any Boolean blocks in the say block (Booleans are the ones with pointy ends) it will only say true or false, so remove those.
This is all you need:
But NOT this:
Thanks a lot! This worked now. I actually did what you showed not to do above.
Another part of the problem asks me to
c. Move to the (x,y) coordinate of (-sideLength/2,100)
d. Point to the right (90 degrees)
e. Drop the pen
Could you please explain what this function will do?
Thanks again for your help!
Offline