FIRST POST!
Today I will show you the baisics of a Calculator project.This will do:
Multiplication
Division
Addition
And Of couse Subtraction.
CALCULATING:
To "calculate" the answer use theese scripts:
<say[(( <{ number 1 }> <+> <{ number 2 }> )) ]for( 5 )secs>
That one was for addition,but you could use the following for
(( <-> )) Subtraction
(( <*> )) Multiplication
(( </> )) Division
(( <+> )) And Addition
THE REST:
Firstly we will create a sprite,It can be any sprite so go wild.
Now we will do the greetings:
<when green flag clicked>
<say[ Hello! ]for( 2 )secs>
<say[ I can do your Maths for you! ]for( 7 )secs>
<forever>
There should be an ask block here saying "What sort of maths?Multiplication,Division,Addition or Subtraction?"
<if><( answer <=> Multiplication )>
There should be an ask block here saying "Pick a number"
<set{ Number1 }to( answer
There should be yet anothe ask block here saying "Pick a number to multiply it by"
<set{ Number2 }to( answer
<say[ Your answer is... ]for( 2 )secs>
<say[ (( <{ Number1 }> <*> <{ Number2 }> )) ]for( 7 )secs>
<end>
<if><( answer <=> Division )>
There should be an ask block here saying "Pick a number"
<set{ Number1 }to( answer
There should be yet anothe ask block here saying "Pick a number to divide it by"
<set{ Number2 }to( answer
<say[ Your answer is... ]for( 2 )secs>
<say[ (( <{ Number1 }> </> <{ Number2 }> )) ]for( 7 )secs>
<end>
<if><( answer <=> Subtraction )>
There should be an ask block here saying "Pick a number"
<set{ Number1 }to( answer
There should be yet anothe ask block here saying "Pick a number to subtract from it"
<set{ Number2 }to( answer
<say[ Your answer is... ]for( 2 )secs>
<say[ (( <{ Number1 }> <-> <{ Number2 }> )) ]for( 7 )secs>
<end>
<if><( answer <=> Addition )>
There should be an ask block here saying "Pick a number"
<set{ Number1 }to( answer
There should be yet anothe ask block here saying "Pick a number to add to it"
<set{ Number2 }to( answer
<say[ Your answer is... ]for( 2 )secs>
<say[ (( <{ Number1 }> <+> <{ Number2 }> )) ]for( 7 )secs>
<end>
<end>
If you have any questions about this script I am more than happy to answer them!
If that has helped you I am happy to help you and if you have any suggestions or comments I will happily take them in,good or bad.
Offline
Hmm, this topic doesn't show a project, but it's a very interesting calculator guide! I think this topic will do better in 'All About Scratch' - let's try moving it there.
Offline
I applaud your use of the forum blocks for making this guide instead of taking the easy way out and using screenshots. I admire your determination. Good guide, also.
I don't know what to say about the blog idea though, but it'll probably work itself out
Offline