CS 1110 Introduction to Computing using Java Grade: letter or S/U Fall 2008
8546 TR 09:05 Hollister B14 Instructor: David Gries 4 credits
8548 TR 11:15 Hollister B14 Newsgroup:

About email
Academic Excellence Workshops
Academic integrity
Staff info
Course material
Times & places
Email Gries

About A7 Answers to questions on A7.
26 October Comments on A5.
26 October Comments on graded A4s.
12 October Rounding
12 October Explanation of HSVto RGB in A4
11 August About the course management system
11 August Make extensions visible on your PC
11 August How to get a summary of lectures
11 August Seeing consultants, TAs, and Gries

A5. Here are a few points about A5.

1. Your Turtle window may act strangely if you put your mouse over it. There are some things about operating systems that are causing this, and we don't know why. Don't be concerned if you window acts a bit strange when you are changing its size or moving your mouse over it.

2. There is a typo in the specfication of function spiral, dealing with the lengths of successive lines. It should say

Line 1 is d pixels long; line 2, 2*d pixels; line 3, 3*d pixels, etc. So each line i is i*d pixels long.

Another way to think about it: add d to the line length at each iteration of a loop.

3. A few students asked how many recursive procedures they had to write. We thought that the following sentence in the handout made this clear: one.

In this task 6, your job is to write a procedure that draws a recursive graphical design. You can choose from a few alternatives given below.

A4: times and comments. Here are statistics on the time spent on A4. This is only for 88 students; we don't have all the times yet:

mean: 7.3 hours. median: 6 hours. max: 25 hours

For function truncateTo5, too many of you translated double parameter d into a string s and then went looking for a period in s to know how to truncate. Some wrote loops to append 0's, although we hadn't had loops. There is a simple way to write the body of this function. As we say in comments, (in other words), d + "" is guaranteed to have at least three characters. So the function body is simpl written as this:

if (d < 0.001)
      d= 0;
return (d + "00").substring(0,5);

For function roundTo5, many of you ignored the hints that what one did depended on the size of paramter d and first changed d into a string and then went searching for the period. Several answers were very contorted. Again, simplicity should reign. Here is how it can be done:

if (d >= 100)
     return truncateTo5(d + .05);
if (d >= 10)
     return truncateTo5(d + .005);
return truncateTo5(d + .0005);

A4: About rounding. A few students came up with a strange case. There is nothing we can do about this. It has to do with the fact that the internal "floating point" numbers used for decimal numbers are, as you know, only approximations. Please read about the example below and perhaps put things into DrJava's interactions pane to verify what we say here.

Put Math.round(7858.5) into the interactions pane and you get: 7859.

Put Math.round(78.585*100) into the interactions pane and you get: 7858 !!!

You can see why when you find the value of 78.585*100, which is: 7858.499999999999

This is because some decimal values are represented not exactly but by approximations.

Because of this, a function call HSV.roundTo5(78.585) will produce "78.58" and not the expected "78.59".

Don't worry about it, because it happens using our roundTo5 as well as yours.



Error in A4: Translation from HSV to RGB. The A4 handout said to use these formulas for Hi and f in translating from HSV to RGB:

Hi = floor(H/60) % 6,
f = H/60 – Hi.

However, Wikipedia says:

Hi = floor(H/60) % 6,
f = H/60 - floor(H/60)

Because H is in the range 0 <= H < 360 (degrees), the two formulas

floor(H/60) % 6    and    floor(H/60)

have the same value, so the simpler one can be used. Thus, we can use:

Hi = floor(H/60),
f = H/60 – Hi.

So, there is no mistake in A4. You can use the given formula for Hi or simply Hi = floor(H/60).

The Wikipedia formula is actually more complicated than it has to be.

We will discuss this in class on Thursday.


About the CMS (Course management system). We use a CS-designed "course management system" to manage assignments, tests, etc. DON'T DO ANYTHING ABOUT IT UNTIL WE ASK YOU TO! Thanks. The CMS for this course is at this URL: http://cms3.csuglab.cornell.edu/.

Fix your PCs so that extensions (like .java and .doc) ALWAYS appear. To do this, do the following: Open an explorer window. Use menu item Tools / Click on Folder Options. Click the view tab. Uncheck the box "Hide extensions for known file types".

Summaries of lectures
Please look at handout 0, which summarizes what we did in lecture each time!

Seeing consultants, TAs, and Gries

Please feel free to see Gries during his office hours --or any time that he is there. If he is not working frantically on something that has a deadline, he will be happy to chat with you. He also looks at email and answers it often.

The TAs have office hours. If you need some conceptual help of any kind, go the the TAs during their office hours. Choose any TA whose office hours are convenient for you, you don't have to limit yourself to your Section TA.

Check here for office hours of TAs and Gries.
TAs have a closed office hour and an open office hour. If you want time alone with a TA because you just don't understand or are falling behind, then arrange a closed session by calling 255-0982 or going to the undergrad office (Upson 303). If you just have a question, go see a TA; there may be other people there at the same time, and you can all hear each others questions/answers. The closed hours will act like open hours if no one has made an appointment.

You can make an appointment for a one-on-one session with any TA at the undergrad office (Upson 303) between 9:30 and 4:30 M-F, or by emailing: ugrad@cs.cornell.edu--24 HOURS IN ADVANCE.

Consultants for CS1110 live in the green room of the ACCEL Lab, which you get to through the Engineering Library in Carpenter Hall. You may spend a good deal of time programming there. The consultants are there to answer your questions. If you need help downloading and setting up DrJava, if you have a misunderstanding on an assignment, if you are having trouble debugging a program —in all such matters, ask the consultants for a quick answer. However, they will not write your program for you.