M,F 2:30, Hollister B14. Start 24 Jan
or
M,F 3:35, Hollister B14. Start 24 Jan
or
M,F 2:30, Hollister B14. Start 06 Mar

CS1130: Transition to OO --Lecture sections

Spring 2012

Instructors: David Gries and Walker White

Assignments

Assignment A1. Rhinos. Due on the CMS on the date specified on the CMS.   pdf    html
This assignment requires mastery. You submit and we grade, you resubmit and we regrade, ..., until it is right.

Assignment A2. J*Man. First submission due on the CMS NO LATER THAN 28 February at 11:59PM!
 a2jman.pdf   a2jman.html   a2jmanstart.zip    jman.jar

Assignment A3. For section 3 only, started on 4 March. To be handed in in class on Friday, 16 March or before.

We have noticed in the earlier lecture sections and self-paced section that people do not learn early enough how to evaluate a new-expression. Some have taken the final test 3 or 4 times and still gotten it wrong, and this has wasted their time and ours and has also affected their understanding about how OO works in Java and other languages. They have misconceptions, which will hurt them in writing and debugging programs. Giving a quiz on the topic doesn't help.

Therefore, we are trying something else. On Friday, 16 March or earlier, you must hand in this assignment A3. Don't try to do it hurriedly as soon as you come to class. Do it well before, and in a way that helps you actually learn the materal. Study what you write. Digest it. Make it part of your ready knowledge about object-oriented programming that you simply KNOW.

1. Put your name and Cornell netId on a fresh sheet of paper.

2. Read the lecture notes for Lecture 03. 12 March (Monday) and study slide number 8, which gives the modified definition of the new-expression. Then, copy the following on your fresh sheet of paper twice, legibly.

To evaluate a new-expression of the form new C(...) , do the following:

  1. Draw (create) a new object of class C, putting in all fields and methods declared in class C and giving it a new name on its tab. Put default values in the fields (e.g. 0 for type int).
  2. Execute the constructor call that appears in the new-expression, i.e.:   C(...)    .
  3. Use the name on the tab of the folder as the value of the new-expression.

Yes, as strange as it may seem, we want you to copy the above slowly and legibly onto your piece of paper, TWICE, concentrating on memorizing it. We know from experience of several hundred students that just reading it once or twice does nothing. Writing it does.

3. Below is a new-expression and a class. Write the new-expression on your piece of paper. Then evaluate the new-expression yourself, carrying out the three steps listed above, drawing the object on your piece of paper and putting the value of the new-expresion to its right.

new D(20)

public class D {

     int x;

     public D(int xxx) {

            x= xxx;

      }

}