Background:

There are three kinds of memory locations that we use in programs:
- variables - variables hold data that can change. For instance, we might be totalling a series of numbers. Each time we calculate the subtotal, we will store it in a variable.
- constant - some values do not change during program execution. These are called constants. Constants are named special values like PI or INTEREST_RATE.
- literals - literals are storage locations that are named with the same name as the value held inside. For example, 1 is a literal representing the integer 1 and "This is a string" is a literal representing the character string, "This is a string". In this simulation, we will not have separate memory locations for literals.

Part 1: Follow an algorithm
You will work in pairs for this exercise. Divide each classroom group into two parts so that we have groups of two or three students only.
Take out two clean pieces of paper. PRINT your group members' names at the top of each page and label one paper INSTRUCTIONS and the other page OUTPUT.
Each time you "execute" an algorithm, begin by cleaning off one of the desks and each time you create a new container (sticky note), place it on that desk. Use pencil to write values into variables (variable values can change); use pen to write values in constants. (constant values cannot change). Whenever writing a value into a variable, you must first erase any previous value in that variable; variables can only store one value!
When your algorithm requires an input value, obtain a number from the whiteboard "input streams".
When your algorithm generates output, use this algorithm:- If the OUTPUT paper has no lines, starting 1/2 inch from the leftmost side of the paper, write the values to be output from left to right.
- If the OUTPUT paper has lines, start at the leftmost margin of the paper, write the values to be output from left to right.
Execute this algorithm
1. Create a variable container named numberOfYards, that can hold integers.
2. Input an integer value and store that value in the container named numberOfYards. (This should be written in pencil.)
3. Create a constant container named YARDS_TO_FEET that can hold integers.
4. Write the literal value 3 into the container named YARDS_TO_FEET.
5. Create a variable container named numberOfFeet, that can hold integers.
6. Write the literal value 0 into the container named numberOfFeet.
7. Multiply the value found in numberOfYards to the value found in YARDS_TO_FEET and write the result IN PENCIL in the container labeled numberOfFeet.
8. Output the value found in the following containers (in the order specified):
- the container named numberOfYards
- the literal " yards is equal to "
- the container named numberOfFeet
- the literal " feet."
Part 2: Write an algorithm.
On your OUTPUT piece of paper, draw a line across your paper to separate your output for Part-1 from your output for Part-2. Using concepts from yesterday's class and the sample algorithm above, write the algorithm to solve the following problem on the INSTRUCTION paper. You may make use of the input and output algorithms simply by referring to them as input and output. Use the naming conventions for your containers as follows:
1. Variables - mixed case beginning with a small letter. No spaces or characters other than hyphen or underscore.
2. Constants - Upper case. No spaces or characters other than hyphen or underscore.
Make sure that you number each step and each step accomplishes one thing.
Create an algorithm to calculate the miles per gallon of a vehicle fill-up.
1. Miles per gallon is calculated by taking the number of miles driven and dividing by the number of gallons purchased.
2. Input to the process will therefore be the number of gallons (decimal numbers) and the number of miles (whole numbers only).
3. You should prompt for the input and label the output as described above.
Be sure that you test your algorithm.
Part 3: Write another algorithm.
On your OUTPUT piece of paper from Part-2, draw a line across your paper to separate your output for Part-2 from your output for Part-3. On your INSTRUCTION piece of paper, create an algorithm which will calculate and output your weighted class average (labs and participation, programming assignments, midterm1, midterm2 and final exam).
1. The input stream will be five integer values representing the five scores in the order listed above.
2. The output should be a line like this "The weighted course average is " followed by the calculated average.
Again, test your algorithm.
Turn in both the OUTPUT and INSTRUCTION papers.