October Announcements |
||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 10/28 |
P5 NEWS:
Students, be sure to get the files from the newsgroup, run the project, and read the assignment -- all in time for section next week, as the program will be discussed. |
|||||||||||||||||||||||||||||||||
| 10/28 |
CATCH-UP REVIEW SESSION:
There is a catch-up review session this Sunday 10/31 at 3pm in
Olin 155. |
|||||||||||||||||||||||||||||||||
| 10/28 |
EXTRA OFFICE HOURS:
Yiqun Liu has added additional office hours from 3:30 to 5:30PM on |
|||||||||||||||||||||||||||||||||
| 10/26 |
P4 HINTS & SUGGESTIONS
|
|||||||||||||||||||||||||||||||||
| 10/21 |
ANNOUNCEMENT BY CS UNDERGRADUATE OFFICE: > We have made some changes in CS courses > that you should know about: > > 1. The CS 211 prerequisite of CS 100 will now > specify a course in Java or C++. What this means > is that students attempting to get transfer credit for > CS 100 will need a qualified course in Java or C++. > The AP College Board Exam in CS is given in C++, so > it will still meet our CS 100 requirement and will serve > as an adequate prerequisite for CS 211. naturally, as students taking CS100, you're all set for CS211. (and to be really obsessive, object-oriented programming should have been mentioned as a pre-requisite for CS 211.) > 2. We will now require all CS majors to take both > CS 211 *and* CS 212 (they used to be functional > equivalents and CS majors took one or the other). > For more detailed information on this change, visit: > > http://www.cs.cornell.edu/Ugrad/Courses/changes211-212.htm > > 3. CS 410 "Data Structures" will not be offered after > Summer 2000. A similiar course for non-CS majors > will continue to be offered. Currently we are offering > this course as CS 409 and it will be taught in the > spring. > > Let us know if you have any questions regarding these > changes. > > Thank you, > > The Computer Science Undergraduate Office > <ugrad@cs.cornell.edu> > 255 0982 |
|||||||||||||||||||||||||||||||||
| 10/17 |
REVIEW SESSION FOR FINAL EXAM
Though still a ways off, the review session for
the final has been scheduled: |
|||||||||||||||||||||||||||||||||
| 10/17 |
SECTION NEWS
Bela is out of town this week and will have his sections covered by Fan, Yan, and 'lan (Alan). See who'll be running your section: 1 tue 1:25 yan 2 tue 1:25 fan |
|||||||||||||||||||||||||||||||||
| 10/17 |
ANOTHER SOLUTION TO Q3A ON SAMPLE PRELIM
public class MM60 { |
|||||||||||||||||||||||||||||||||
| 10/17 |
SAMPLE SOLUTION TO P3 USING ARRAYS
Room.java using arrays Cave.java
(program with the demon; NOTE that we didn't have to change a thing!) |
|||||||||||||||||||||||||||||||||
| 10/17 |
NEW TUTORING ROOMS Starting this week, the following TAs will be holding their office hours in 476 RHODES HALL. We will post a notice on the door of 455 directing students to the new room. TAs that are affected by this change and their
tutoring times: TUESDAY WEDNESDAY THURSDAY |
|||||||||||||||||||||||||||||||||
| 10/15 |
PRELIM 2 REMINDER:
The exam is this Tuesday, 7:30-9PM. Go to the appropriate room based on your last
name: |
|||||||||||||||||||||||||||||||||
| 10/15 |
HW3 SOLUTIONS ERRATA:
Near the end of class Application in the while loop, the if statement for the Demon's next move should read if
(demon.farRoom(door) != null) and NOT if
(player.farRoom(door) != null) NOTE: the Web version of the solutions varies slightly from the Carpenter version (it prompts the user differently in class Application and uses variables, first, second, & demonDoor instead of r1, r2, and door (for the demon) |
|||||||||||||||||||||||||||||||||
| 10/15 |
REVIEW SESSION:
There is a review session this Sunday from 3-5PM, OH 155. Enter the building using the Gannett-facing door. |
|||||||||||||||||||||||||||||||||
| 10/15 |
CORRECTIONS TO SAMPLE
PRELIM 2 ANSWERS:
As of this morning, there were two errors in the Sample Prelim 2 answers [the corrected version is below]: First Error Second Error c.tens = ( tens + b.tens + c.ones / 10)%6; and NOT |
|||||||||||||||||||||||||||||||||
| 10/15 |
SAMPLE PRELIM 2
ANSWERS: 1. a) ![]() b) 7 8 1 3 7 8 3 null 2. a) ![]() b) toString returns a value. to print a value, it would be: public void toString() { String s = "null"; if (c != null) s = "" + c.b; System.out.println(a + " " + b + " " + s); } NOTE: Java requires toString to return a String. c) A "class" is "model" or "blueprint" that defines the fields (or instance variables) and methods of its instances (objects). d) A "method" is a named piece of code that performs a task; it can take values as parameters (or arguments) and can return a result value. e) "public" means "can be seen by code anywhere". "private" means "can be seen only by code within the class". f) "static" means "only one copy, only accessible through/within the class". "non-static" means one copy per instance, only accessible via (a reference to) an object. 3. a) // repeatedly do something N times int counter = 0; while (counter < N) { do-something; counter++; } // process input sequence of pairs of values // terminated by a pair (stop1,stop2) of stopping values int a = in.readInt(); int b = in.readInt(); while (a != stop1 || b != stop2) { process-a-and-b; a = in.readInt(); b = in.readInt(); } b) int trurl = 0; // y position of trurl int klapaucius = 0; // y position of klapaucius int x = 0; // #steps; also, x position of trurl, klapaucius int same = 0; // how often trurl and klapaucius meet while (x < 200) { if (Math.random()<.6) trurl++; else trurl--; if (Math.random()<.45) klapaucius++; else klapaucius--; if (trurl == klapaucius) same++; x++; } System.out.println("They met " + same + " times"); 4. a) Note: The fields below are public to allow code outside the class the modify them, but this is BAD style: They should be private, and there should be methods for setting and getting the fields. This way, the MM60 code can enforce the specified contraints (ranges) on the fields. public class MM60 { public int tens; public int ones; public MM60 add(MM60 b) { MM60 c = new MM60 (); c.ones = ones + b.ones; c.tens = (tens + b.tens + c.ones / 10)%6; c.ones %= 10; return c; } public void swap(MM60 b) { int tmp; tmp = ones; ones = b.ones; b.ones = tmp; tmp = tens; tens = b.tens; b.tens = tmp; } } b) a.swap(b); b.swap(c); OR a.swap(c); a.swap(b); OR b.swap(c); a.swap(c); NOTE: x.swap(y); has the same effect as y.swap(x); thus, the code above could be b.swap(a); c.swap(b); OR c.swap(a); b.swap(a); OR c.swap(b); c.swap(a); c) MM60 a = new MM60(); int m = (-x) % 60; if (m<0) { m += 60; m %= 60; } a.ones = m % 10; a.tens = m / 10; NOTE: it would have been bad style to modify x. d) a.add(a).add(c) <-- no semicolon, since this is an expression |
|||||||||||||||||||||||||||||||||
| 10/14 |
SAMPLE PRELIM 2 QUESTIONS:
Prelim 2 concentrates on what we have covered since Prelim 1 (up through Program 3) but will also include material covered by Prelim 1. Arrays are NOT covered. However, arrays are a natural place to use loops, and you need to learn about array s for Program 4. Thus, you might wish to rewrite Program 3 to use arrays to eliminate the search in method "findRoom" and to allow any number of doors per room. Below are sample Prelim 2 questions. Please use the newsgroup to communicate with us regarding errors, clarifications, etc.
|
|||||||||||||||||||||||||||||||||
| 10/14 |
ROOMS FOR PRELIM 2:
(go to the appropriate room based on your last name:) |
|||||||||||||||||||||||||||||||||
| 10/13 |
WORKING TOGETHER:
remember, the only allowed groupings are EITHER singletons and pairs. |
|||||||||||||||||||||||||||||||||
| 10/8 |
RESIZING THE CONSOLE WINDOW:
the console window on macs is resizable and scrollable. |
|||||||||||||||||||||||||||||||||
| 10/7 |
SWITCHING FROM CS100 TO
CS99
i understand that, after prelim 1, some of you are considering |