# 2.4 Scr0140: arithmetic operators  (Page 6/7)

 Page 6 / 7

## Various numeric representations

The block labeled sqrt will deliver about a dozen different representations of numeric values, depending on what is selected from thepull-down list. This includes the square root, trigonometric functions, absolute value, etc.

## Rounding a number

Finally, the block labeled round will round a decimal number to the nearest whole number.

## Drag and drop the plus and minus operators

Image 4 shows the result of dragging the top two green blocks from the left panel and dropping them into the white boxes in the bottomtwo orange variable blocks in the center panel of Image 3 .

## A few more steps are required

If you compare Image 4 with Image 2 , you will see that Image 4 is close to what we need but we aren't quite there yet. In order to causethe bottom two blocks in the center panel in Image 4 to match the bottom two blocks in Image 2 , we need to do the following:

• Click the orange Variables button in the upper left of Image 4 to expose the variables as shown in Image 1 .
• Drag the blocks for the variables named LeftOperand and RightOperand from the left panel and drop them into the white boxes in the bottom two blocks in Image 4 to make them match the bottom two blocks in Image 2 .

That's the solution. The upper left portion of your Stage area should now look similar to Image 5 . Note however that you may need to use the mouse to arrange the four variables and the button to get your Stage arrangedlike Image 5 .

## Operation of the program

Once you reach this point, you can click the green flag to initialize all four variables to zero.

Then you can move the sliders back and forth to manually set the values for the variables named LeftOperand and RightOperand .

Then when you click the button at the bottom of Image 5 , the variable named Sum will display the sum of the values of the top two variables, and the variable named Diff will display the value of LeftOperand minus the value of RightOperand .

## An online version of this program is available

A copy of this program has been posted online for your review (see Resources for the URL) . If you don't find the program using that URL, search the Scratch site for the usernamed dbal.

## Run the program

I encourage you to use the information provided above to write this program. Experiment with the code, making changes, and observing the results of yourchanges. Make certain that you can explain why your changes behave as they do.

Just for fun, move the button a little to the right and cause it to say Ouch for about five seconds each time you click it as shown in Image 6 . Hint: See the purple button labeled Looks in Image 3 .

I also encourage you to write the program described below.

## Student programming project

Write a Scratch program named Arithmetic02 that produces the output shown in Image 7 when the user adjusts the sliders to the values shown and clicks the button. Make the word Ouch! appear and then go away after about five seconds.

what is a market demand schedule
What is demand curve
Types of demand curve
mohamed
demand curve is a showing the aggregate of demand whether falling from right to the left in the table above
BULAMA
demand curve is the graphical representation of various quantities of a commodity bought at various prices
Blessed
What is the formula for calculating elasticity
what is demand
demand is the quantity of commodity that consumers wil be able and wiling to buy at a given price at a given time
Delly
it is the exchange of goods and services across international borders.
Tweneboah
what is taxation
the definition of economic by Adam Smith
Adam Smith define economic as the science of wealth
Hafsat
What is enconomics
mohamed
what is meant by pisp in economics?
payment initiation service provider
Khuselo
what is demand
demand
Demand refers to the consumers' desire to purchase goods at given prices. Demand can mean either demand for a specific good or aggregate demand for the total of all goods in an economy.
What is economc
What is economc
nahurira
What is Economic
What's the price index of consumption?
what population
I think it's the sum total of people in a goegraphical area at a given time
Ruth
it refers to the number of people living in a particular area over a given period of time
Vanessa
decribe law of demand
the higher the price , the higher the quantity demanded
Ruth
what is economic growth
what is an economic system
Metuge
Economic system is the mechanism which deals with the production, distribution and consumption of good and services in a particular society
Happy
of course
Maesela
what is a weight
Maesela
What is a weight
mohamed
Got questions? Join the online conversation and get instant answers!