Announcements
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
A7: Listening to mouse movement. We are getting emails about how to get the paddle to respond to mouse movements. We give some details here, but basically we want to to figure this out. Read below carefully and try to figure it out yourself. If you are still unable to listen to a mous movements, feel free to email us. We talked about the concepts you need for listening to mouse events in the GUI lectures, and Tuesday's lecture gave a bit more detail, for reference. (a) What are the three things that must be done to react to a mouse event? We didn't repeat them in the A7 handout because they were given quite clearly in the second GUI lecture. So look carefully at the second GUI lecture and understand what was done to listen to a mouse event. (b) One thing we gave you in the handout: you had to write method mouseMoved. (c) What else needs to be done? Wouldn't it stand to reason that the ACM folks who built the graphics package would provide what you need? Is Breakout a subclass of something? Perhaps the ACM folks have written some intermediate code layer that takes care of what has to be done. How might you find out? A subtle error in A4. The text fields and buttons that allowed the user to input color values and then click one of the buttons were added just this semester. An error was introduced that had noting to do with the computation. Instead it has to do with "listening to sliders". It is fixed, and you can now use the applet and jar Here's the quite subtle error, which took time to find. Whenever a slider value is changed, the system notices it and calls a method to process the change. So when values were placed in the CMYK fields and the InCMYK button was clicked, a lost of computation went on that ended up setting many slider values. Each change in the slider value caused the method that "listened to sliders" to be called, resulting in more unexpected computation, and ths caused the error. The solution was: When a button like InCMYK is clicked, in the method that is called, (1) turn off listening to changes in sliders, (2) do all necessary computation and setting of the GUI, including the slider values, and finally (3) turn on listening to changes in sliders. Much laer in the course, we will show you how GUIs are built and show you how methods are written and registered with the system to listen to events, like button clicks and changes in cliders. You will not have to learn much of this kind of stuff, but it will be useful for you to ahve seen it. Sorry for this mistake. More help on function round2Five. The tendency is to try to convert d to a String so that the period can be located, change the result a bit, convert back to a double, and call truncate2Five. Resist this temptation. It's clumsy and awkward. Instead, just add something to d and then call truncate2Five --what you add may depend on the size of d. Suppose d >= 100. Then, the five-character result will have the form xxx.x, where the x's are digits. Ask yourself what you have to add to d so that truncating to 5 characters will then yield the right result. Here are two cases to consider:
We could tell you what to add to d in this case, but then you don't learn yourself how to solve little problems. Besides d >= 100, there are two other cases to deal with: 10 <= d < 100 and d < 10. A subtle programming error in function eatenBySame. What should be the value of the call Organism(b, c) where b and c are Organisms that are still alive, that is, have not been eaten? Looking at the specification,
one would conclude that the value of the call is false. Two alive organisms certainly were not eaten by anything. But many of the eatenBySame functions in A3 submissions said the value was true. This is because, if both eatenBy fields are null, b.eatenby == c.eatenby is true. The body of this function should not have been:
It should have been:
If one had developed test cases beforehand, with an eye to covering all possibilities and extreme cases (e.g. eatenBy(b, b), where b is alive), the error would have been detected. Developing good test cases taks conscious efforst and is an arts in itself. The conclusion to draw is that programming can involve subtle points, and one must be careful in the specifications of programs, in their implementations, and in testing them. For some, this whole process can be tedious. Others have immense satisfaction in this process of specifying, implementing, and testing. To each their own. The principle of using existing methods applied to A3. We have mentioned (and illustrated) several times the use of a previously written and tested method in writing new methods. This principle can save programming time, reduce the number of errors introduced into a program, and make testing easier. Below, we give another example from A3. Note how simply the third constructor is written using two calls on other methods:
Here is a second example. The second isHigherThan function can be written using a call on the first.
Here, note how the specification is simply translated into Java: 1. org1 is not null is translated into org1 != null 2. and is translated into && 3. Compare the expression org2 is not null and org1 is at a higher level than org2 with the specification of the first isHigherThan function,
and you see that the expression can be translated into org1.isHigherThan(org2) . A note on assignment a1. Procedure
is being executed. The best thing for you to do is to draw the two objects, writing down (only) the variables and fields being used. Get in the habit of drawing objects to help you figure things out. Now, java has keyword VideoNote Beginning Tuesday, 15 September, the 11:15 lecture will be filmed and place on www.cs.cornell.edu/videonote/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. About quizzes. About 80% of the class got 100 on the first quiz. They had no problem with explaining how to execute an assignment statement <var>= <expr>; ---evaluate the <expr> and store its value in the <var>. However, the other 20% had not studied enough to know this simple fact. This is disheartening for us. We are working so hard to give you a good, effective experience in learning programming using Java. After many years of teaching, we know what works and doesn't work. We know that if you don't learn some basic things right away, as soon as you hear them, you will have a very difficult time later on. We also know that teaching (and learning) the next material is far far easier if you have learned the current material. The course builds steadily; it is cumulative. So we give quizzes. We tell you precisely what will be on a quiz, because we know you should master that material immediately. We know the consequences if you don't. We expect everyone to get 100 on each quiz. You have a quiz on Tuesday, 15 September. Please, everyone get 100 on it. What will be on the quiz is explained here. What we have done so far is not difficult, just new. Achieving full understanding and a fluency in Java requires practice. It is better to practice every day for 15 minutes, reading the book and doing exercises on the computer using DrJava, than it is to wait 2 weeks and then spend 6 hours cramming. Please learn to budget your time for maximum learning. About labs. Please read these guidelines for labs carefully.
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. Complete Quiz 1 ("First Day Survey") on the CMS. It's available by logging in at this URL: http://cms.csuglab.cornell.edu/. If login fails or you don't see the course "CS1110" listed, it may be because you are not entered into the CMS, in which case, email Maria Witlox at mwitlox@cs.cornell.edu, letting her know your netID and that you are in CS1110. About the CMS (Course management system). We use a 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. Then, if you see the course number CS1110, click on it to get to the CMS. If you don't see the course number, that means you are not yet registered in the CMS. Email Maria Witlox mwitlox@cs.cornell.edu and ask her to add you. You must give her your netid. H1N1 flu preparations. See this link 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 Seeing consultants, TAs, Lee, Gries Check here for office hours of TAs, Lee, 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. 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.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||