Computing Concepts with C++ Essentials
Laboratory Notebook
Instructions

Cay S. Horstmann
Geof Pawlicki
John P. Russo

Important Note

These are the original instructions, as supplied by the authors. If you are reading this text, then your course instructor has not modified these instructions for use at your institution. In particular, electronic submission of the lab forms will not be possible. Check with your course instructor how you should submit your work!

About these Labs

These labs are companions to the book "Computing Concepts with C++ Essentials". These exercises are designed to be carried out in a computing laboratory, or in home study, with a C++ compiler to test programs and either a web browser to view the assignments, or simply a printout of the web pages.

Each lab has a few review exercises (marked R) and programming exercises (marked P). Instructors should feel free to select a subset of the exercises to match the lab schedule. Some of the review questions can be answered with or without a computer; some require the students to write simple test programs.

All of the lab exercises assume either access to an ANSI standard compiler or the CCC libraries that implement the necessary ANSI C++ features for pre-ANSI compilers. Some exercises use the CCC graphics library.

Lab Contents

Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Chapter 13
Chapter 14
Chapter 15
Chapter 16
Chapter 17
Chapter 18

For Students: How to Use the Labs

You need to ask your course instructor how to submit your lab work. Here are the most popular options:

Use paper

Simply print out each lab (with the "Print" command of your browser), then fill in your answers with pencil and paper. However, don't write programs into the supplied boxes. That is, ignore the instructions /* paste program here */. Instead, print the programs out separately, clearly label them and attach the printouts. Submit your work in the usual way.

Use paper for the review questions, disk submission of the programs

Simply print out each lab (with the "Print" command of your browser), then fill in your answers with pencil and paper. However, don't write programs into the supplied boxes. That is, ignore the instructions /* paste program here */. Simply save them to a floppy disk and attach it to the lab form.

Submit the review questions through the browser, email the programs

Fill in the answers to the questions in the browser, but skip those questions that ask you to paste your code into the form windows. However, don't type programs into the supplied boxes. That is, ignore the instructions /* paste program here */. When you are done, click the "Send to" button. Email your programs to your instructor separately.

Submit everything through the browser

Fill in the answers to the questions in the browser, and use "copy and paste" to paste your work whenever you are instructed to /* paste program here */. When you are done, click the "Send to" button.

An important note about the browser

It is best not to use the browser for web browsing while you work on your lab. If you move away from your form, it is easy to lose the work that you have already completed. If you do move away from the form (for example, to read these instructions), always use the "Back" button to get back to your lab. Never use the "Reload" button or another link to the lab page--that reloads a new form that has all entries blank, and your work is lost.

Notes on Programs

For Instructors: How to Customize these Instructions

Decide whether you are interested in electronic submission of lab work.

Electronic submission has several advantages: It reduces printing costs in the labs. You don't have to read the students' handwriting. If you are ambitious, you can write scripts to automate some of the grading.

Of course there are disadvantages. Students with less computer experience may find it difficult to switch between the browser and the compiler. You, or a lab administrator, needs to put a "CGI script" on the web server and modify each of the lab HTML files to work with that script. This is not difficult but it requires familiarity with HTML and CGI scripting. Furthermore, there may be an increased risk of cheating.

If you are at all unsure, it is probably wise to err on the side of caution and use paper submission. Or you can give your students the choice. That way, you won't have to spend time supporting students with less computer experience.

You should then modify this file. Remove this section and the next. Remove all options from the preceding section that you don't want your students to use. Remove the note at the beginning of the file. If you do opt for electronic submission, the lab HTML files need to be modifed as well. That process is described in the next section.

For Lab Administrators: How to Modify the HTML Files for Web Submission

Please note: This procedure is unsupported by the author and the publisher. If you do not have the expertise to carry out the following steps and perform your own testing and debugging, then neither the author nor the publisher will be able to assist you. Do not attempt these steps unless you are well grounded in HTML and CGI scripts.

You need to place a CGI script on your web server that can handle the form submission. The simplest handling is to email the form content to the instructor or grader. For this purpose, you would use an email script such as this mcsmail Perl script. You need to put the script onto your web server. Of course, if you are ambitious, you can do more processing on the student data than just emailing them, by writing your own CGI script.

Please note: You must use your own server. The Mathematics and Computer Science department at San Jose State University cannot host your traffic, and you have no permission to use their server except for testing purposes. The mcsmail script is supplied as an example only and is unsupported by the author and the publisher.

Next, you need to edit each of the lab HTML files.

Each lab HTML file contains the following HTML code near the beginning of the file. You need to change the bold portions.

    <FORM ACTION="http://www.mathcs.sjsu.edu/cgi-bin/mcsmail" METHOD="POST">
    <TABLE BORDER="0">
      <TR>
        <TD>Your name: </TD>
        <TD><INPUT TYPE="text" SIZE="20" NAME="username"></TD>
      </TR>
      <TR>
        <TD>Your email address: </TD>
        <TD><INPUT TYPE="text" SIZE="20" NAME="recipientaddr"></TD>
      </TR>
      <TR>
        <TD>Your student ID number: </TD>
        <TD><INPUT TYPE="text" SIZE="20" NAME="ID"></TD>
      </TR>
    </TABLE><INPUT TYPE="HIDDEN" NAME="useraddr" 
    VALUE="instructor@institution.edu"><INPUT TYPE="HIDDEN" 
    NAME="recipientname" 
    VALUE="yourself since this form has not been customized for your
institution">
    <INPUT TYPE="HIDDEN" NAME="subject" VALUE="CCC Lab1">
    <HR>
    
    <P><A NAME="#submit"></A>Once this form has
been customized for your       institution, you can use this button <INPUT TYPE="submit" VALUE="Send lab">
      to send your lab work. Be sure to read the <A HREF="instructions.html">instructions</A>
      before starting your work.</P>
    

Do the following:

  1. Change the POST target http://www.mathcs.sjsu.edu/cgi-bin/mcsmail to your own web server and your own script. The Mathematics and Computer Science department at San Jose State University cannot host your traffic, and you have no permission to use their server except for testing purposes.
  2. Flip the username and recipientname so that the contents is sent to the instructor or grader, not the student.
  3. Replace instructor@institution.edu with the correct email address of the recipient.
  4. Replace yourself since this form has not been customized for your institution with the name of the recipient of the email.
  5. Remove Once this form has been customized for your institution, you can