Subject: solutions posted to prep questions
Date: Wed, 3 Mar 1999 12:18:07 -0500 (EST)
Cc: (Adrian German)
I've posted the solutions to the open ended prep questions for the midterm.
I also want to remind you that you can get up to 5 extra points on the
midterm if you practice with the multiple-choice items in QuizSite (the
larger activity, Midterm_ALL) before the midterm tomorrow. 
Practicing with the multiple choice items will help with your review. 
You will get 5 points if you get 100% on the practice quiz, if you get
less than 100% you will get that percentage out of 5 points. 
So for a person that gets 100% on the practice quiz and all the points on
the exam (75 points possible) the score will be 80 out of 75 which means
extra-credit on your total grade. 
Midterm format: multiple-choice items and short answer roughly similar
with the ones posted for practice. Review homework assignments 5, 6, 7,
lecture notes 9, and 11 especially and the materials posted on the web.
Good luck and let me know if I can be of help. I respond to short answers
quickly I am much slower with code mailed to me this week. 
My office hour of Friday has been moved tonight (5:30-6:30pm) for this week. 
... Adrian 

Subject: midterm and homework info To: Date: Mon, 1 Mar 1999 08:58:15 -0500 (EST) Cc: (Adrian German) Since I was late one day posting homework 7 I would like to extend the deadline for collecting homework 7 to Thursday at midnight. I believe it would help you if you try to submit by Tuesday because you could then concentrate on the review for the midterm but if it helps you, you can turn the programs in by Thursday midnight instead of tomorrow. I posted help in getting started with Vectors, and I will post a few more lines about in the evening. The midterm will be a combination of multiple-choice and short answer questions. I posted multiple-choice items to practice with in QuizSite and on the web site for your review. Tomorrow the lecture will also be a review. The midterm is on Thursday in class. Please review problems like the ones on homework 5, 6, 7, and the ones posted yesterday (both the short answer and multiple-choice items). If I can be of any help please let me know. I am a bit slower with e-mail these days but I will try to make it up by answering all my e-mail within 24 hours from now. Please make all efforts to stay in good health by Thursday so that you don't miss the midterm. I think you're going to be very well prepared for the midterm, so keep working hard and good luck. .... Adrian

From: Adrian German Subject: A202 readings for tomorrow Tuesday To: Date: Mon, 22 Feb 1999 11:34:27 -0500 (EST) Cc: (Adrian German) I need to rely on the textbook for tomorrow's reading assignment. I will not be able to post lecture notes until tomorrow morning at 8am. So for tomorrow's lecture check out the following pages from the textbook: pp. 366-368 (3 pages from chapter 14 on vectors) pp. 410-412 (3 pages from chapter 15 on stacks and queues) pp. 275-278 (3 pages from chapter 11 on recursive methods) Also loosely review arrays (for your reference pp. 188-207 in chapter 9). We'll start the lecture reviewing a few aspects that have not been covered in class explicitely (from lecture notes 9 and 11) regarding the use of this and super in constructors. We'll also look a bit at homework 6 then quickly describe what homework 7 is about. We'll implement a Stack object using Vectors -- this will help you with homework #7. We plan to end tomorrow's class by introducing recursion and by writing a few simple recursive methods. Thursday we will review graphics in a new way, but by then I will have the notes posted on the web site for that day's lecture. If you have any questions or need any help please let me know. ... Adrian

From: Adrian German Subject: lecture notes posted To: Date: Mon, 15 Feb 1999 12:47:39 -0500 (EST) Cc: (Adrian German) I've posted the lecture notes for tomorrow. They're again comprehensive, and in class we will cover part of them and part of Chapter 10 in your textbook. See you tomorrow. ... Adrian

Date: Sun, 7 Feb 1999 00:06:13 -0500 (EST) Cc: (Adrian German) By many accounts the course was already going fast and it didn't slow down at all this week. I looked at the feedback and have talked to Sean and Kasey after the labs this week. Please do your best on this week's homework and let me know if you're stuck and need any help. You should be able to do well on this homework. You are a good class, a very capable group of people. Next week we'll review once again the basics. We'll give up on some of the glitz associated with graphics and we'll concentrate on getting the basic notions right. Without rock solid foundations we can't move into inheritance and without that we can't do almost anything at all. A slower pace and a more interactive style in the lecture have been on the top of the list of your requests. I am working on that. Meanwhile if I can be of any help please let me know. ... Adrian
From: Adrian German Subject: Lecture Notes To: Date: Wed, 3 Feb 1999 14:01:23 -0500 (EST) Lecture notes for tomorrow have been posted. You can print them and bring them with you to class. (You should find them quite useful for your labs too). This should help at least those who happen to sit in the 2 quarters of the room that are too close to the board, on the sides of the small amphiteathre. We will not be able to move from BH006 so I will try to post the notes for each lecture in advance from now on. Also, the most important part of the code developed and discussed in class yesterday has been posted as well. If you have any questions or need any help please let us know. ... Adrian
From: Adrian German Subject: Interesting (fwd) To: Date: Fri, 29 Jan 1999 04:13:56 -0500 (EST) Cc: (Adrian German) Shawn Travers, working on Assignment 3, reports: > Adrian, > > I just did something that I found to be interesting. While working > on the assignment (#3), I changed the location variable in the Player > class to static. I noticed that, all of the players suddenly began to > move around the board as a single group. While I am sure this result > is quite evident to an experienced java programmer, it was interesting > to me, because it helped me to better understand what it means for a > variable to be static. Anyway, I just thought I might pass this along > to you. It might be an excellent instructional tool for anyone who > still has lingering confusion about the difference between a static > (or class) variable and an instance variable. > > Shawn Thanks Shawn, very nice point. ... Adrian
From: Adrian German Subject: A202 week of 01.25-29 To: Date: Sun, 24 Jan 1999 17:58:21 -0500 (EST) Here are a few announcements at the beginning of a new week: first off, make sure that you solve problem 1/83 without / or % just loops, - and >. Turn your assignment in by e-mail as detailed in the labs or in the page located at There's an exam coming up on Tuesday. A sample review exam with solutions can be found at and solutions for lab 2 are being posted as well on the lab notes page (they are going to be finished this evening I'm halfway through right now). Grades for quizzes have been posted. Based on them I can see they're not much of a challenge for you and so I will make a few changes: quizzes will become occasional and may be given in the labs while feedback opportunities will continue to be available to you every week but they will be optional, and I'll have details later. There is no reading assignment per se for Tuesday. The reading assignment for Thursday will be announced in class. Expect a few changes to the order of topics listed in the syllabus page since I would like us to get started with chapter 12 (graphics) this Friday in labs. Tuesday after the exam I will present the anatomy of a Java program, and I will give you an operational tool to reason about your programs, objects and classes, instance variables and class variables. I will post lecture notes on the course web pages. Good luck on the mini-exam on Tuesday and let me know if you need any help! ... Adrian
From: Adrian German Subject: quick update To: Date: Thu, 21 Jan 1999 00:41:08 -0500 (EST) We'll move the lecture quizzes at the end of the lecture period, and we'll start collecting assignments electronically with this assignment, #2, like in A201. Your lab coordinator will have the details. You can still turn in the analysis on paper tomorrow, or by e-mail. Lab 2 notes have been posted, it will be a good review for the exam that's coming up on Tuesday. A few notes on the review exam on Tuesday have been posted too and will be augmented with more info as soon as I have a chance. I think we'll start returning graded lecture quizzes this week. If you have questions or need help let us know, come and see us during office hours or contact us for an appointment anytime. ... Adrian
From: Adrian German Subject: Math.random() To: Date: Tue, 19 Jan 1999 13:23:08 -0500 (EST) Math.random(0 returns a number between 0 (inclusive) and 1 (exclusive). The code I wrote on the board in class was: class Hoosier { void cheer() { int dice; dice = (int)Math.round(Math.random() * 6 + 1); // [1] switch (dice) { case 1: case 2: System.out.println("I-N-D-I-A-N-A!"); break; case 3: case 4: System.out.println("Go IU Beat Purdue!"); break; case 5: case 6: System.out.println("Hoosiers! Hoosiers!"); break; } } } In this code dice will be set to 1, 2, 3, 4, 5, 6, and (alas!) 7. So in line [1] it would be better to multiply by 5. That would be the correct way to do the exercise. Notice that we're lucky though: no harm is done since if dice is set to 7 no matching case will be found (we don't have a default case) so nothing will be done. But the code is ugly and I should have been more careful. Math.round() rounds a floating-point number to its closest whole number, as we mentioned in class. As a reminder, the course web page is at If you have more questions please let us know. ... Adrian
From: Adrian German Subject: this week (01/19-01/22) To: Date: Sun, 17 Jan 1999 12:35:25 -0500 (EST) Greetings and I hope everybody's having a great weekend! This message contains a few reminders and announcements for the week that starts tomorrow. There's an assignment due on Tuesday in class. You will need to turn in the source code of the assignment on a floppy disk to one of us before or after the lecture. It's probably wise to check it in Cafe before you turn it in, although you can develop it in any Java environment you like. (As a reminder, the assignment due this Tuesday is 2/p.35 and 14/p.58). In your programs, please use a consistent style and make sure that we can clearly identify you, your lab section and the assignment by looking at your source code. Insert a comment block of the following form at the beginning of your programs, as you have done in A201: /* Name: Your Name Username: Your Username Lab Section: Your Lab Section #, Meeting Time and Place Lab Instructor: Your Lab Instructor's Name or Username Assignment: Number and Due Date of The Assignment */ You may want to write the first four items on the disk label anyway. This week in lecture we will review: * control structures (if, and if-else, nested if statements and the dangling else, the while, do-while, and for statements, the switch, break and continue statements) * arrays (looping, searching, inserting, sorting) and * user-defined methods We will also introduce user-defined objects and classes (instance and class variables and instance methods) through several simple exercises. We will end this week with an object-oriented version of Candyland. The reading assignment for Tuesday is on pages 60-83 and 113-120 of your text. The 5' closed-book quiz at the beginning of the lecture will be on case study 4.1 (page 64 in your textbook, interface in figure 4.2). You'll have 4-5' to write down the program on page 64 in your book). Quizzes will be graded by me and returned to you in the lab by your lab coordinator. Lecture notes for the introduction to user-defined classes and objects will be made available on the web Monday afternoon. Reading assignment for Thursday is on pages 85-96 and 188-207 of your text. The 5' closed-book quiz at the beginning of the lecture will be announced in class, on Tuesday. Lecture notes for the object-oriented version of Candyland will be made available on Wednesday around noon together with the lab notes for this week. Homework assignment for this week: 1/83, 11/84 and an object-oriented version of a game different from, but similar to, Candyland. I'll announce this again in class. There's an exam coming up on Tuesday January 26. It will be a 30' exam, in class. There will be a guide for the exam posted on the web Thursday morning at 8am. The guide will give you an idea of the format of the exam. The exam will cover: simple conversion programs with BreezyGUI (window objects: buttons, labels, numeric and text fields, layout, messageBoxes,) decision and selection statements (if, switch), looping constructs, other control statements (break, continue) and arrays. If you have any questions or if you need any help please let us know. ... Adrian
From: Adrian German Subject: distribution list To: Date: Thu, 14 Jan 1999 14:28:44 -0500 (EST) I include a rather contrived example that compiles and runs fine and shows that, if you want, you can declare and create new window objects in buttonClicked. Of course you'd probably want to have a good reason for it first, I suppose, but it is possible, although not recommended. ---------------------------------------( )------------- import java.awt.*; import BreezyGUI.*; public class Seven extends GBFrame { Button a = addButton("Button", 2, 1, 1, 1); public void buttonClicked (Button b) { Label c = addLabel("Hello, world!", 1, 1, 1, 1); } public static void main(String[] args) { Frame f = new Seven(); f.setSize(200, 200); f.setVisible(true); } } // If you try this you need to resize the window after you click // the button before you can see the new label "Hello, world!"). ------------------------------------------------------------------ This is just for the sake of stretching the code until we understand our degrees of freedom. c in the example above would not be available outside buttonClicked and (in this example) it would refer to a new Label, that gets positioned on the screen, every time a is pressed. The bottom line is that we should stick with the recommended template, the one on page 16 of your text. You should be comfortable by now with the way it works, but if you have any questions please let me know. This is also the first test of the new distribution list that I set up yesterday. I will use this list to post messages twice a week to you on the topics of the lectures. We will collect weekly feedback from you on any aspects of the class that you may want to address using QuizSite, starting early next week. We'll post grades using Post'em as soon as we have something to post. The web course page is at and it is updated frequently. If there's anything you need help with please let any one of us know. ... Adrian