CSC 101, Fall 2008

Lab 1 


Objectives

This is the common part of the lab, shared among some instructors. Here, our goals are:

Aside

This is commentary that is not part of the assignment, but is intended to help you understand some of the ways we write about things.

Overview

The Rules

Lab Requirements

 

Part 1: The Linux Environment

  1. Get connected:

  2. Get started with the command line:

  3. Your first program, your first bug:

  4. Lessons to learn:

  5. So what about that warning?

  6. Are we there yet? Sadly, no.

Part 2: Using JGrasp - This part is not mandatory.  Do it if you intend to use jGrasp.

  1. The first part of the lab showed you how to create and compile a program from the command line.  Some/most of you will prefer to create and compile programs using a more Graphical User Interface.  To do this, follow the instructions here: Using JGrasp

  2. Many of you will want to install JGrasp on your personal windows machines.  If so, follow the instructions here.

  3. To transfer files from your Windows home machine to your vogon account, you can use Secure Shell Client program (for Windows) [5.5 MB] 

Part 3: Running interactive programs

  1. Examine the source text for the Number Juggling Program.
  2. Predict the results from executing the program.  In this program the user must provide input data.  Use your own birthdate and age as input values.  Predict the result that the program will produce.  
  3. Start jGRASP, create a new editor window, and Copy-and-Paste the text from the listing. Save the program as numberjuggle.c
  4. Compile the program.  It should compile without errors.  
  5. Execute the program.  When the program displays the prompt, provide your input data.  Observe the actual output that is produced.  Compare the actual output to your predictions.  If there is a discrepancy, determine if you calculated wrong or if there is an error in the program. 
  6. There is nothing to submit for this part of the lab.

Part 4: Finding Defects

  1. Read the header comments to determine the purpose of the Cable Revenue Program.
  2. The source code has several defects that have been inserted by the instructor.  Study the source code and try to identify the mistakes.  Note them in your lab notebook.
  3. Start jGRASP, create a new editor window, and Copy-and-Paste the text from the listing. Save the program as cablerevenue.c
  4. Compile the program.  Several errors will be reported.
  5. Attempt to fix the errors.  In some cases the error message is very obvious and you will see immediately what needs to be corrected.  In other cases, the error message is vague or confusing.  You might find this list of common error messages helpful. Write each error message and the correction which fixes it in your lab notebook.  If you are stuck, you may get assistance from your peers or the instructor.
  6. Execute the program.  When the program displays the prompt, provide the sample data of 3 installations and 15 yards of cable.    Observe the actual output that is produced.  Compare the actual output to your predictions.  If there is a discrepancy, determine if you calculated wrong or if there is an error in the program. Resolve the discrepancy and describe it in your lab notebook.
  7. Demo the correctly running program to your instuctor on Vogon.

Handin - This part is to be setup later, do not try it yet, just review it to become familiar.  When Dr. Turner sets up handin for this course, he will instruct you to try it out (probably Friday).

  1. Submit your hello.c and cablerevenue.c using handin. To do this, you must do the following steps.
    1. Connect to vogon.csc.calpoly.edu using ssh or just open up a command shell if in the lab. 
    2. Once on vogon, navigate until the current directory is your cpe101/lab01.
    3. Execute the handin command:
                  handin gradercst lab01-15 hello.c cablerevenue.c
      This command submits your files to the lab01 directory in your instructor's account. 
    4. If you execute the handin command without a filename, it will report the files that you have submitted. This is a good way to check that your files were submitted correctly!
              handin gradercst lab01-15