Respuesta :
Answer:
There are going to be more actions in this list since you are putting yourself in the computer's perspective. Below is a sample list of actions you would need to take to make a peanut butter and jelly sandwich.
open all the containers
open the bread bag
take out two slices of bread
open the peanut butter jar
open the jelly jar
Dip the knife into the peanut butter
spread the peanut butter on the bread
Dip the knife into the jelly
spread the jelly on the other piece of bread
2. Pattern As you take a look at your lists, you will notice that some of the steps repeat opening jars and spreading things on bread. These are good examples of patterns. It means that if you can figure out how to open the peanut butter jar and how to spread the peanut butter onto a slice of bread, these methods can be used for jelly.
Checking Assumptions
Abstraction is much more than solving a simple version of the problem. This principle is great for checking assumptions. Although you are trying to put yourself in a computer's perspective and assuming the computer doesn't know anything, this principle allows you to make guesses to solve parts of the problem.
As you look at your peanut butter and jelly sandwich problem, think about what assumptions you can make. Identifying and even writing out these assumptions will help you figure out parts of the smaller problems you identified earlier. Some of the assumptions you could make for the peanut butter and jelly problem are the following items:
The computer knows what a knife is
The computer knows how to open jars
The bread isn't in a bag
The bread is sliced
So the assumption the computer knows a knife means that you don't need to define what a knife is right away and can define it later when it is time to do so. It also means you can work better and put your attention on solving the more important components of the problem.
3. Algorithm Writing
Once you've solved the simplest version of the peanut butter and jelly sandwich problem, you are ready to put together your algorithm. You've done all the hard work so now you are just writing out the instructions for the computer to use. Think of this step as writing a final draft for an essay or paper.
As you write your algorithm, always keep yourself in the mindset that the computer doesn't know anything. Having this mindset is going to help you not only look at the algorithm from a computer's perspective but will help you double-check your algorithm to see if you missed anything or where potential errors might pop up. Try writing the peanut butter and jelly algorithm on your own first.
Instructions
1. Decide what bread you want to use.
2. Open the bread bag.
3. Pick a slice of bread closest to you and put it on the plate.
4. Open the peanut butter jar.
5. Dip the knife in a peanut butter jar.
6. Spread peanut butter on the slice of bread.
7. Put down the knife.
8. Decide what jelly you want to use.
9. Open the jelly jar.
10. Dip the knife in the jelly jar.
11. Spread jelly on the slice of the bread.
12. Put down the knife.
13. Pick one slice of bread and place it on top of the other slice of bread.