CS 102 Alternate Assignment

This assignment is a walkthrough of lab2 to help those of you who had trouble with that lab to understand it better before you get too far behind. You will need internet access and a connection to Eagle for this assignment.

Steps:

  1. Login to eagle

  2. start tcsh (type tcsh at the command line.)

  3. Make a directory called Lab2-rev

    1. mkdir Lab2-rev

  4. move into the newly created directory.

    1. cd Lab2-rev

  5. copy the lab2 skeleton file into the new directory (if you put the skeleton in your home directory last time you can use the following command)

    1. cp ../lab2Skeleton.zip .

    2. Which means copy the lab2Skeleton.zip file from the parent directory to the current directory

  6. now unzip the file

    1. unzip lab2Skeleton.zip

  7. move into the lab2 directory that you just created

    1. cd lab2

  8. Look at the lab2 assignment. You need to first implement three has-a and 1 knows-a relationships in the LavaLamp class. Both the knows-a and has-a are implemented in two parts. The first part of each is to have an instance variable for the object that is had or known. Open LavaLamp.h and you will see that the instance variables are there already. So now open LavaLamp.cpp (using jed or your favorite editore) And look at the constructor.

    1. Remember that for a knows-a relationship, you have to initialize the instance variable with a value that is passed in as a parameter to the constructor. There is only one parameter, so where it says //put your code here finish implementing the knows-a by doing:

      1. _keyMan = keyMan;