Suppose you want to show the number of people
buying food at the staff canteen one lunchtime.
The numbers might look something like this.
So for example we've got drink and snack 20
people, hot meal 60, salad 25, sandwich 55
and soup and bread 40, with a total number
of people 200. We're going to look at how
to create this on a pie chart. Here we have
the code that I used in order to create that
first slice of pie. So remember that that
was for 20 out of 200 people, i.e. the number
of people that we've got in this problem wanting
to buy a drink and a snack. So let's just
draw that slice of pie using this. So if we
click on this top block here, we would get
that first line drawn, and now we've got to
create this slice of pie here by moving the
sprite through an angle here and drawing a
line up here. So if we click on this, that
has drawn this slice of pie. And as I said
before, we've used this calculation here -- 20
out of 200 people, multiplied by 360 creates
the slice of pie we need for this number of
people. The sprite is now in the right position
in order to draw the next slice of pie. So
how do we do that? Well we could just quite
easily drag out the commands for the next
slice and the next slice and the next slice,
etc. But it's easier if we can just copy and
paste this code. So if we right click on there,
and click duplicate we've now got a new block
which we can click and position down here,
and we can now change these numbers. Because
obviously if we keep these numbers the same,
we're just duplicating it for another lot
of 20 out of 200 people. But now we've got
60 out of 200 people wanting a hot meal in
this particular example. So if we change that
to 60 out of 200 and we then click on that,
we see our next slice of pie drawn, and the
sprite is now back in the right position to
draw the next line to represent the next slice
of pie. So what I would like you to do is
to see if you can duplicate more blocks of
instructions and change the numbers appropriately
to draw the rest of the slices of pie so that
we've got a completed pie chart for the rest
of the problem. Don't worry about putting
the circle round -- we're leaving that as
an activity for you to do later.
