# EECS 183 Labs

# EECS 183 Lab 1: Algorithms

### Lab due **on your scheduled lab day**

### Lab accepted for full credit until Tuesday, September 6th, 11:59 pm Eastern

### Google form link to submit lab assignment

In this lab assignment, will write an algorithm to make a sunflower butter and jelly sandwich. While working on the lab, you will learn some of the tools you need to master the course beginning with Project 1.

## Learning Objectives

Students should be able to identify that developing successful algorithms requires them to know the following:

- What data are available to use to solve a problem
- What functions/operations are available
- How to correctly sequence (ordering) tasks
- How to handle special cases
- How to know the level of detail required

## Key Concepts

- Programs are expressed as a set of instructions.
- The first step in creating a proram is creating the set of instructions, expressed as an
*algorithm*. - Programs must provide a thorough, well-organized, and literal set of instructions, so the algorithm for a program must do the same.

# Assignment

Your task for this lab is to write an algorithm to make a sandwich. You should approach this problem by assuming that your algorithm will be given as a set of instructions to a robot that does not understand what a sandwich is. That is, your algorithm should be taken literally and still be able to produce an edible sandwich.

Complete this lab in a group with 2-3 others. Find a way to write your algorithm somewhere everyone can contribute – whether a piece of paper, a Google Doc, or a laptop everyone can see. You will submit a text copy of your algoithm using the link above.

## How to write an algorithm

An *algorithm* is a series of steps used to solve a problem.
An algorithm can be written with different language, but it must contain the steps required to solve the problem.
You could write an algorithm using English (or any) language prose. However, it is more helpful to write an algorithm using *pseudocode* or alternately using a *flowchart*.
Pseudocode is an informal description of an algorithm.

Write an algorithm for the problem using the pseudocode from lecture and lab as a guide. There is no universal pseudocode, and yours may look a little different.

Here is an example of pseudocode for making a sandwich. However, this is nowhere near as detailed as you will need to be.

### Starter Sandwich Algorithm

- Take a slice of bread.
- Put sunflower butter on the bread.
- Put jelly on the bread.
- Take another slice of bread.
- Put the second slice of bread on the first.

Here’s a picture of a sandwich made with this algorithm, which will hopefully explain why you need to be more detailed!

## Test Your Algorithm

If someone in your team has immediate access to the materials, try to execute the steps of the algorithm. Othwewise imagine going through the steps, preferrably using other objects to represent the items needed. Be as literal as possible in following the steps of your algorithm – try to make the silliest sandwich that literally follows the instructions. Test each part of your algorithm as you progress: preparing the bread before moving on to sunflower butter, applying sunflower butter before moving on to jelly, etc.

## Grading

**10 points for completion.**

Implement your algorithm and submit with the lab form. Does your algorithm implement the features required by this specification? Would another person who has never made a sandwich be able to follow your detailed instructions?

## Submission

When your team has completed your algorithm, **each person** must submit the following Google form to receive credit for the lab.
Your team can and would be expected to submit the identical algorithm developed as a team.

- Head to this Google form
*while signed into Google with your own @umich account*and follow the on-screen instructions. Type your answers in the form, and be sure to select Submit to submit the form.