CS 1110 Introduction to Computing using Java    Spring 2011  
9066 TR 09:05 Hollister B14 Instructors: David Gries  
9067 TR 11:15 Hollister B14 Grade: letter or S/U.   Credits: 4
 

Announcements


27 February Notes on assignment A4
21 February Can't use Javadoc? Look here
19 February Notes on assignment A3
05 February Notes on assignment A1
05 February Notes on quiz 1
20 January Using VideoNote
20 January Can't open the DrJava jar file
20 January About labs
20 January Haven't received any CS1110 email yet?
20 January No serial number/device ID on your iClicker?
Register your iclicker, even if it's used.
20 January About the course management system
20 January Make extensions visible on your PC
20 January How to get a summary of lectures
20 January Seeing consultants, TAs, Gries

Can't use Javadoc. A number of student cannot use the javadoc button in DrJava on their computer. It usually is a PC running windows 7, and some Ecclipse software is on the computer --for example, the ECCLIPS compiler is being used in DrJava; look at the compiler pane. Some students have been able to fix this by downloading and installing the JDK. Look here to see how to do that.

[Note. To run Java one needs a JRE: Jave Runtime Environment. To compile Java programs and do other things, one needs a JDK: Java Development Kit.]

Notes on Quiz 1, The assignment statement.

  1. Because this was the first quiz and many people did not understand and follow directions, we are reducing the weight of this assignment to .3 (instead of 1).
  2. Many people did not read carefully. They did not read the small box on 28 (which said how to execute the assignment) and during the test, they did not read the instructions on the ppt slide (see below). Reading and following directions is important!
  3. A circled "1" or "2" on your Quiz means that you either (1) did not say how to execute the assignment or (2) what you did say was wrong or (3) you did not DO it —you did not store the value in the variable. The box on page 28 makes it clear: "Evaluate the expression and store its value in the variable." That is all you have to say, because that is how it is done.
  4. This is about reading. The ppt slide that you looked at to do the quiz said, "Write down, in English, how to execute this assignment statement (don’t explain how to evaluate the expression x+y–1)". And yet, quite a few people explained how they would evaluate the expression x+y-1. Why do this when it says not to? What we wanted you to say was, "evaluate the expression and store its value in the variable."
  5. A circled "3 means you wrote something akin to this:

y = x+y-1       This is absolutely wrong because the "=" sign is not being used
y = 9+4-1       as an equality but as an assignment sign. The stuff to the right
y = 13-1         would be OK if it were equality, but it IS NOT. This is one of the
y = 12            confusions that arose from this misuse of the "=".

If you can do the above, then in executing the assignment y= y+1; you could do this:

y = y+1           Does this sequence make any sense at all? Of course not.
y-y = y-y+1     You wouldn't and shouldn't write this, because the "=" here
0 = 1               is being used as an assignment sign, not equality.

If you want to carry out the first step, evaluating the expression, like this, this is fine:

x+y-1 = 9+4-1 (since x contains 4 and y contains 9) = 13.

Assignment A4
0. Using application a4.jar on the Macintosh. Some students with Macintoshes have not been able to execute the jar file a4.jar. Student Lee Carlaw has found the problem and solution, at least on several Macintoshes. Thanks, Lee!

(1) Click the mac spotlight --the magnifier icon in the very upper right of your window and type "Java Preferences" in the field that shows itself.

(2) In the window that pops down, select the application Java Preferences. The Java Preferences window opens.

(3) In the "General" pane, you will see two lines with CPU-types 64-bit and 32-bit. Drag the 64-bit line above the 32-bit line.

That's it! If this doesn't work, let us know.

1. assert statements. In the file A4Methods.java that we gave you, function truncateTo5 begins with an assert statement:

assert 0 <= d && d <= 99;

An assert statement has the form "assert<boolean expression> ;". It is executed as follows: evaluate the <boolean expression>; if it is false, terminate execution with an assert-exception error message (if it is true, do nothing).

In the case of truncateTo5, the assert statement is the same as the precondition. Therefore, if the precondition is false and execution of the assert statement terminates the program, then you have an error --either your program incorrectly calls truncateTo5, so you have an error in your program, or perhaps you incorrectly called it in the interactions pane.

Some advocate leaving assert statements in a program to check for things like preconditions even after a program is completed and checked out, just in case there is one last bug that was not caught and might be caught this way.

2. Function min. If you have to find the minimum of two values, use function Math.min(x, y). Look in the API specifictions for it. Principle: use methods that you or others have written to save yourself time and energy.

3. Rounding. In two functions that convert to RGB, you are asked to round doubles to integers. DO NOT USE roundTo5!!! That function is used ONLY to get values in a form suitable for printing in the GUI. How should you round? We suggest that you look in the methods in class Math for something suitable. Look in the API specifications. Class Math is always available; it need not be imported.

Assignment A3
1. On method isSisterOf: The name of the method and its specification appear to conflict. Yes, we should have called it isSister. But do not change the name or the specification. Go by the specification. It is always the specifiction that matters, not the name.

2. The specification of isSisterOf has a typo. The precondition should be "e is not null" instead of "r is not null".

3. The last page has a typo. Put a comment stating how much time you spent on A3 at the top of file Elephant.java, not file Person.java. Sorry about that.

Assignment A1 1. We neglected to require getter function getTag. You need this function to be able to test that the constructor initialized this field properly. We have updated the assignment on the website. Please add this method with this specification:

/** = the tag on this Elephant (-1 if none) */
public int getTag()

2. Some people have questions about the field that contains the number of children. Here are some comments.

1. The constructors do NOT have a parameter for this field. Nevertheless, the constructors MUST store an appropriate value in this field.

2. In the second constructor, THREE objects are involved: the new one, the mother, and the father. The second constructor must make sure that the number-of-children field is correct in all THREE objects.

3. Some people question how the mother's or father's field can be changed if there is no setNumberOfChildren procedure. Such a procedure is NOT needed and should NOT be added. Just use an assignment statement.

VideoNote Beginning Tuesday, 15 September, the 11:15 lecture will be filmed and place on www.VideoNote.com/cornell. Along with the video comes a table of contents; click on an item and the video changes immediately to the place corresponding to the item you clicked.

Use VideoNote as a supplement to the course. Look at a video if you want to go over some part. If you have to miss a lecture because of the flu, anther illness, an interview, a sports roadtrip, use VideoNote to see the lecture.

Don't use VideoNote to skip class regularly, as a prop to allow you to postpone studying, and so on. That will hurt you in the long run. Our study of the use of VideoNote shows that it can hurt rather than help the C- student who misses lots of lectures and procrastinates on studying because they feel they can catch up later with Videnote.

Together, the provost's office and the College of Engineering are spending $5,000 so that you can have access to VideoNote. Appreciate that.

Can't open the DrJava jar file. When ou double-click on the DrJava jar file, that application is supposed to open up. However, there may be a problem with your Windows Operating system, especially if it is WIndows 7. If you have this problem, try visiting this website and downloading and installing application JarFix:

http://www.softpedia.com/get/Others/Miscellaneous/Jarfix.shtml

About labs. Please read these guidelines for labs carefully.

  1. You are expected to attend a lab session each week. You do not have to be formally registered in the lab you attend, but you should regularly attend the same lab. If you miss more than 3 labs (or don't do the assignment for 3 labs) without a reasonable excuse given to the Lab TA beforehand, we reserve the right to lower your grade a notch (e.g. from B to B-). We don't do this very often, but we reserve the right to do it.
  2. If you do not complete a lab the week on which it is handed out, complete it at home during the week and show it to your Lab TA the next week.
  3. Labs that are not completed by the next week will not be counted.
  4. Please do not email Profs. Gries or Lee about who to see or what to do if you missed a Lab. Talk to your LAB TA.

Haven't received CS1110 email yet but able to login to to the CS1110 CMS website? The problem may be that you've set email forwarding improperly; we've received a few email bounce messages. Check that you are having mail to <your netID>@cornell.edu forwarded to a valid addresss. (If you also can't login to the CMS website, then the problem is that you aren't entered into the system; email Maria Witlox, as described in the CMS announcement below.)

No serial number/device ID on your iClicker? This number, needed to register the clicker, can be recovered by bringing your clicker to (a) the Academic Technology Center Room 123, Computing and Communications Center on the Ag Quad, open 9-5; (b) the ATC's G27 Stimson Hall office near Day Hall, open 12-5; or (c) Prof. Gries and Lee's office hours, 167 Olin Hall, Tuesdays and Thursday 10:10-10:55.

Register your iClicker, even if it's used. Do so by visiting http://atcsupport.cit.cornell.edu/pollsrvc . You'll login with your netID and password, and you'll need the serial number, or device ID, of your clicker, which can be found, perhaps near a "bar code", on the back (you may wish to put some invisible tape over the serial number or write it down somewhere, since the numbers can rub off). Note that each individual student in CS1110 needs their own clicker.

About the CMS (Course management system). We use the CS-designed "course management system" to manage assignments, tests, etc. The CMS for this course is at this URL: http://cms.csuglab.cornell.edu/.

When you visit the site, you will have to give your Cornell netid and password. The CMS is not yet populated with the enrolled students. We will let you know when this has been done. For now, don't concern yourself with the CMS.

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 courseOutline.html, which summarizes what we did in lecture each time!

Seeing consultants, TAs, Gries

Check here for office hours of TAs and Gries.

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.

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 contacting a TA individually. If you just have a question, go see a TA during their open office hour; 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. Contact the TA.

Consultants for CS1110 hold hours 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.