JMU
Lab: Gaining Experience Writing Algorithms (Without Computers)


You must work on this lab with the person sitting next to you. For each question, the person sitting on the left must "expand" (by clicking on the double-headed arrow) the problem/task on the left and the person sitting on the right must "expand" the problem/task on the right. You must not "expand" or read the the other problem/task.

After reading your problem/task, you will write an algorithm for completing it on a piece of paper. Then, you will exchange algorithms with your partner, and execute your partner's algorithm. When executing the algorithm, you must follow the instructions exactly as they are written.

1. Writing Simple Algorithms: This part of the lab will give you some experience writing simple algorithms.
  1. If you have not already done so, introduce yourself to the person sitting next to you.
  2. What is your partner's name?


  3. Read and understand one of the following problems/tasks:
    Problem/Task for the Person on the Left

    Write an un-named algorithm for drawing a square that is 2 inches on each side.

    Expand
    Problem/Task for the Person on the Right

    Write an un-named algorithm for drawing a right triangle that has a base of 2 inches and a height of 3 inches.

    Expand
  4. Exchange algorithms with your partner.
  5. Without discussing it, execute your partner's algorithm exactly as it is written (without doing any damage to anything or anyone).
  6. Discuss the problems you had executing your partner's algorithm with your partner.
  7. What was incorrect or imprecise about your algorithm?


2. Writing Algorithms that Require Input: This part of the lab will give you some experience writing simple algorithms that require input. (Hint: Before you start, review the previous lab and think about what you did with input.)
  1. Read and understand one of the following problems/tasks:
    Problem/Task for the Person on the Left

    Write an un-named algorithm for drawing a generic right triangle (i.e., a right triangle whose size is not determined in advance). The person executing the algorithm should be instructed to ask for the base and height of the right triangle.

    Expand
    Problem/Task for the Person on the Right

    Write an un-named algorithm for drawing a generic rectangle (i.e., a rectangle whose size is not determined in advance). The person executing the algorithm should be instructed to ask for the width and height of the rectangle.

    Expand
  2. Exchange algorithms with your partner.
  3. Without discussing it, execute your partner's algorithm exactly as it is written (without doing any damage to anything or anyone).
  4. Discuss the problems you had executing your partner's algorithm with your partner.
  5. What was incorrect or imprecise about your algorithm?


3. Writing Algorithms that Require Calculations: This part of the lab will give you some experience writing simple algorithms that require calculations. (Hint: Before you start, review the previous lab and think about how you used variables in calculations.)
  1. Read and understand one of the following problems/tasks:
    Problem/Task for the Person on the Left

    Write an un-named algorithm for calculating and displaying the perimeter of a generic rectangle (i.e., a rectangle whose size is not determined in advance). The person executing the algorithm should be instructed to ask for the width and height of the rectangle.

    Expand
    Problem/Task for the Person on the Right

    Write an un-named algorithm for calculating and displaying the area of a generic right triangle (i.e., a right triangle whose size is not determined in advance). The person executing the algorithm should be instructed to ask for the base and height of the right triangle.

    Expand
  2. Exchange algorithms with your partner.
  3. Without discussing it, execute your partner's algorithm exactly as it is written (without doing any damage to anything or anyone).
  4. Discuss the problems you had executing your partner's algorithm with your partner.
  5. What was incorrect or imprecise about your algorithm?


4. Writing A More Complicated Algorithm: This part of the lab will give you some experience writing algorithms that are a little more complicated.
  1. Read and understand one of the following problems/tasks:
    Problem/Task for the Person on the Left

    Write an un-named algorithm for calculating and displaying the total area of three shapes: a square, an equilateral triangle, and a circle. The person executing the algorithm should be instructed to ask for a single number that will be used for the length of the sides of the square, the length of the sides of the triangle, and the radius of the circle. (Note: You may look up any equations you have forgotten.)

    Expand
    Problem/Task for the Person on the Right

    Write an un-named algorithm for calculating and displaying the total perimeter of three shapes: a square, an equilateral triangle, and a circle. The person executing the algorithm should be instructed to ask for a single number that will be used for the length of the sides of the square, the length of the sides of the triangle, and the radius of the circle. (Note: You may look up any equations you have forgotten. Also, recall that the perimeter of a circle is sometimes called its circumference.)

    Expand
  2. Exchange algorithms with your partner.
  3. Without discussing it, execute your partner's algorithm exactly as it is written (without doing any damage to anything or anyone).
  4. Discuss the problems you had executing your partner's algorithm with your partner.
  5. What was incorrect or imprecise about your algorithm?


Copyright 2013