Lab01 Update, CISC105, Fall 2004

Overview

Here are some updates to lab01:

  1. A small fix for the lab01a.c program (one character, but it makes all the difference.)
  2. Another optional correction to the lab01a.c assignment (You are free to either accept this correction or ignore, for this week, since it is coming so late in the game).


  3. A clarification for getting the web ring working.

The main part of this lab will still be due next Wednesday, however I'll ask your TA to give you a few extra days (through midnight Friday 9/17) before he/she starts
checking the web ring part of the assignment.

If you already submitted your lab01, and would like to resubmit it, email your instructor and your TA to request a "reset". You can also request that in your next lab meeting. A "reset" does not affect any of your files on Strauss; it only removes your submission from WebCT. Note that after a reset, you are still responsible for re-submitting ALL of your files for the assignment. If you do so after the deadline for that assignment, late penalties may apply.

A hints document is also available.

This document contains corrections/clarification/updates; I've also created a separate document that has hints about lab01. If you are stuck on some part of lab01, you may want to read that document also.

1. A fix to the C program lab01a.c

In the C program lab01a.c (the temperature conversion program), the following statement appears:

scanf("%f",&tempSuppliedByUser);

Since the variable tempSuppliedByUser is of type double, this statement is not correct. Instead, the statement should read as follows (the changed part is in bold:)

scanf("%lf",&tempSuppliedByUser);

Note that the characters lf here are "l" as in long, and "f" as in float. (The first one kind of looks like a 1 (numeral one), which is why I'm make a point of telling you it is the letter "l".) Together, these two characters make up the lf format specifier, which is used with the double data type in C.

Putting in lf instead of f is the easiest fix.

Another possible fix is to change everywhere that it says "double" to "float", since the "f" format specifier is actually supposed to be used with float. With that approach, you'd also want to change the lf in the printf statment from to just f. That fix involves a lot more typing, but it could also work.

For purposes of this assignment, either fix is acceptable as long as the program produces correct output when you are done. If you have questions, ask your TA or your instructor before you submit your work.

2. An optional correction in the lab01a.c assignment
(Celsius to Farenheit? Farenheit to Celsius?)

As one student wrote:

I have encountered something confusing in lab01. The lab states "Your job is to edit the program ... so that it converts, instead, from Farenheit to Celsius." However, when i compile and then run the program, it already converts from Farenheit to Celsius, just incorrectly. I was wondering what you would like us to do after this point. I will skip over this section until i can get back to it.

This student's confusion is understandable, and I apologize for the error that led to it.

The task I intended to give you was to turn a program that converts Farenheit to Celsius into one that converts Celsius to Farenheit (i.e., to change the direction of the conversion.) I got confused when writing up the assignment, and described the conversion going in the wrong direction (that is, the program _already_ converts from Farenheit to Celsius, so I should have asked you to change it into one that converts from Celsius to Farenheit.)

If you want to get the maximum learning from the assignment, that is what you should attempt to do: change the program so that it converts in the opposite direction, i.e. Celsius to Farenheit. That involves changing the formula, the prompt, the name of the function, and the comments to reflect the new purpose of the program.

Because the initial directions were unclear, I'll ask the TA to accept either program (as long as it is a correct program): that is either a Farenheit To Celsius program (with a fix to the scanf statment so that it works properly; see the beginning of this update), OR a Celsius to Farenheit program that works properly. After all, it wouldn't be fair for me to change the rules of the assignment so late in the game.

The important thing is that which ever program you submit, the formula, the comments, and the prompts should all match up, and when you script the program, the program should give correct output for whichever way the conversion is going.

3. A clarification and some hints about the web ring

Remember that you are actually creating two web pages for your lab01 assignment.

Unfortunately, I wasn't clear on one subtle, but crucial point in the original lab01 instructions. To make the web ring "work", you need to link your CISC105 web page to the next student's CISC105 web page, not to the next student's personal page. The original example actually shows you linking to the next student's personal page, but this is incorrect. Here is a corrected example of what the ~/public_html/cisc105/index.html file should look like (the changed part is in bold):

    
    <html>
      <head>
        <title>Joe Sample's CISC105 Web page</title>
      </head>
    
      <body>
        <h1>Joe Sample's CISC105 Web page</h1>
    
        <p>I had to do this <b>web page</b> for my 
           <a href="http://udel.edu/~pconrad/cisc105"> CISC105 class</a>.
        </p> 
      
    <p>Part of this page is to make a web ring.
    The next student in this web ring is <a href="http://udel.edu/~jsmith/cisc105">Jane Smith</a>. </p> <p>Here is a picture of me: <img src="jsample.jpg"></p>
    </body> </html>

    The text still looks the same after it is formatted by a web browser:

    Joe Sample's CISC105 Web page

    I had to do this web page for my CISC105 class.


    Part of this page is to make a web ring.
    The next student in this web ring is Jane Smith.

    Here is a picture of me:



    However, when you hover over the link to jsmith's web page, it should now show that the link is to jsmith's cisc105 web page, rather than her personal web page. That way, we will truly have a web ring.

 


Phillip T Conrad