This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-01-22 22:36:56

NancyA
New Scratcher
Registered: 2011-01-22
Posts: 4

Using Operators in Scratch

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  smile

Offline

 

#2 2011-01-22 22:39:35

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Using Operators in Scratch

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:
http://i55.tinypic.com/50slqt.gif
or this if it's already in the variable:
http://i51.tinypic.com/r8xlqg.gif

But NOT this:
http://i53.tinypic.com/21n4aac.gif
(Note the pointy ends)

Last edited by Kileymeister (2011-01-22 22:43:20)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#3 2011-01-22 22:50:24

NancyA
New Scratcher
Registered: 2011-01-22
Posts: 4

Re: Using Operators in Scratch

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

 

Board footer