Lab 6 - Spring 2019

This week in class we learned about trees, and saw two examples of data definitions of trees: a rumor mill and a pipeline. We designed one function in class for a pipeline, which determined whether there was water running. We followed the Design Recipe and the data definition from the lecture notes. We developed a template for a function that consumes a pipeline, and returns a boolean value.

Today in lab we will write three more functions that consume pipelines, again using the template each time for a function that consumes a pipeline. The first function will turn on all the faucets, the second one will count all the faucets that are turned on, and the third will modernize the given pipeline.




How to get started

  1. Use your CS account to login to one of the Linux workstations in the classroom.

  2. Open a browser and copy/paste this URL: https://classroom.github.com/a/5FCFitW1

  3. Login to Github and you will be prompted to accept this assignment
    • Note: this will create your own copy of Lab 6 for you to work on, but it's not on your Linux account yet

  4. Open a terminal window.

  5. Create a new directory for this lab in your cs101 directory by entering the following at the Linux prompt:

    cd cs101
    mkdir lab6
    cd lab6

  6. Type the following commands to pull down a copy of this lab from GitHub:
    $ git init
    $ git remote add origin https://github.com/Vassar-cs101-mlsmith-spr2019/lab-6-yourGitHubID
    $ git pull origin master



Now you are ready to write some functions using the Design Recipe!

Instructions

  1. Launch DrRacket and open your lab6.rkt file

  2. Fill in your name where <YOUR NAME> appears in the comments at the top of the program.

  3. Develop the functions for the Exercises as described below.
    • solve each exercise in order
    • follow the steps of the Design Recipe for each function
    • be sure your solution for each exercise includes all appropriate grading artifacts.

  1. Your lab6 starter code contains the data definition, examples, and template function for a pipeline. It also has the function we developed in class: water-running?.
  2. When the temperature drops well below freezing, it is recommended that homeowners turn on a faucet in the house, furthest away from where the water supply enters the house. The water should drip from the faucet, to help prevent the pipes from freezing. One dripping faucet is sufficient, but for this lab, we're going to get a little carried away… :-O
  3. Scroll to the bottom of the lab6.rkt starter code, and add the new function, drip, which turns on all the faucets in the pipeline. Don't forget to follow the Design Recipe, which means writing tests (check-expect's) before you write the function body, and using the template for a pipeline as the starting point for the function body. You should have at least five (5) tests for this function, using all five (5) examples of a pipeline that we used to test the water-running? function.
  4. Implement the count-on function as specified in the starter code, following the Design Recipe.
  5. Implement the modernize function as specified in the starter code, following the Design Recipe.

Submitting your work

From a terminal window, type the following commands at the Linux prompt:

$ git commit -m "finished lab6" lab6.rkt
$ git push -u origin master



Log out

When you are done, close DrRacket and log out. Always remember to log out when you are done using the system, to ensure that no one else uses your account.