Donut Calculator

Assignment 4:  Donut Calculator

You are planning to serve donuts after Mass.  How many donuts will you need?  Make a Scratch project to calculate the number of donuts required, provided your program’s user tells you the number of people attending and how many donuts an average person eats.  Create a visual representation of the number of donuts required using the “stamp” block to repeatedly stamp out donuts on screen.

If you are stuck with how to get started or need to review how to complete the assignment, there is a six-minute video explaining and demonstrating how to complete it.

Minimum Requirements

Use the “Ask” block to get the user to tell you how many people are expected to eat donuts, and how many donuts an average person will eat

Calculate and inform the user of how many donuts they will need

Stamp a copy of a donut sprite, once for every donut needed, to provide a visual representation of the required donuts.

Start new rows of stamped donuts when needed.  When starting a new row, re-positioning the stamp to the start of the new row: change Y by a negative amount for the row height, set X to the X position where your row starts.

You will need at least two sprites:  a character to ask questions and respond with answers, and a donut.  The donut can be hand drawn in the Scratch costume editor.  Decorate it with sprinkles, make an apple fritter, go crazy!  You can also make this a pie calculator, a cake calculator, or whatever other item you choose.  Make the dialog in your project make sense for your project’s theme.

Blocks you will need to use:

Variables Create a variable for every piece of information you need.  You will need at least two variables:  one for the number of people and one for the donuts per person.
Sensing / Ask Collect information such as the number of people eating donuts and average donuts each person eats
Sensing / Answer The answer to the question asked.   “Answer” only has the answer to the most recently asked question, so if you need to keep track of more than one answer, you will need to store the answer in a separate variable: drop the blue “answer” block from Sensing into the orange “set variable to __” block.
Control:  Broadcast and When I Receive Once all information is stored in variables, Broadcast a message such as “make the donuts” to the donut sprite.  The donut sprite should have a Control / When I Receive block to start running when it receives the broadcast message.
Operators / Join Join variables or calculated values together with text to form a sentence.  For example “You are going to need 64 donuts” where 64 is a value calculated by your program.
Pen / Stamp Stamps a copy of the sprite
Pen / Clear Clear the screen of any previously stamped sprites.  Do this at the start of your project to start with a clean screen.
Motion Change X and Y values of the donut between stamps.  This moves it around prior to stamping.  You can also reference the x and y position as variables to know when you are at the end of a row and need to move down and left to the start of a new row
Control / Repeat To control how many times you need to stamp the donut sprite

That’s a lot of blocks!  Take your time and experiment with each one to get comfortable with how it works.

Exceeding Expectations

Is this too easy?  Are you some kind of Scratch Ninja?  Here are some extra features for those who seek to exceed expectations:

Change the program to reflect new information:  children have a different appetite for donuts than adults!  Collect more information (number of children, number of adults, how many donuts each eats) to build a more complex calculator.

Make it so it stamps boxes of a dozen donuts, including a partially filled box at the end for any remainder.  How about a baker’s dozen?

Use color effects to vary your donut as it is stamped, or add a few other donut sprites for variety.

Add appropriate sound effects