Everyone is encouraged to ask questions---lots of them. The best ways to do this are:
The calendar states that in order to enrol in this course, you must have completed CSC148 or CSC150, have a cumulative GPA of 2.5, or be enrolled in a CSC subject POSt. As there have been some questions about this, some explanation is probably in order.
First, when you enrol in a courses, your prerequisites are not automatically checked. This is because they can't be, at least not accurately, because spring term grades are not in yet. The checks are run afterwards, and a list of students lacking prerequisitess is then sent to the department.
Second, all second year courses require either that you have a 2.5 CGPA or that you are enrolled in a CSC subject POSt. As instructors, we cannot waive the CGPA prerequisite. To apply for a CGPA waiver, you must submit a letter explaining your extenuating circumstances, along with a copy of your academic history, to the undergraduate office. Students who need a waiver and don't get one will be removed from the course.
Less formally, you ought to know the basics of programming in Java before taking CSC207. We will assume that you know what a class is, that you can write a method containing loops and conditionals, and that you are comfortable with arrays. You must also know how to use sets and lists, and how to use iterators to step through their elements.
If you haven't used Unix before, you will need to master the basics during the first two weeks of the course. You may find it helpful to pick up a book on Unix (such as Unix: Visual QuickStart Guide, by Deborah and Eric Ray).
Please bring printed copy of the slides for the lecture, and the source code for the lecture's examples, so that you can make notes. (But please don't print these out more than a day in advance, as we may make late changes.) Note that you have the source for the lecture slides in your individual CVS repositories, so that you can put them on your laptop (if you have one).
There is no set text for this course, although there is a recommended reading list. Much of what you will need to know is available on-line; part of the course is learning how to find it.
Good programmers use lots of tools well, and build new ones for themselves as needed. CSC207 will introduce you to:
With regard to other tools:
The due date for each assignment will be announced at least one week in advance. Anything submitted up to four (4) hours after the due date will have 20% deducted from its mark. Anything submitted after that will not be marked. Exceptions will be made only for natural disasters, illness (accompanied by a doctor's note), abduction by aliens (accompanied by a note from the aliens), and serious personal emergencies. Please note: "I couldn't get CVS to work" is not an acceptable excuse. You should check material in via CVS as you do it---CVS allows you to revise what you have submitted as many times as you want.
If you wish a late submission to be considered for grading, you must send mail to the professor no later than 10:00 p.m. on the due date (i.e. at most an hour after the late cut-off).
If you feel that an assignment has been unfairly or incorrectly marked, you may submit it for re-marking. In order to do this, you must:
Note that any assignment submitted for re-marking will be completely re-marked, and that marks may go down as well as up.
Please make sure you have the latest version of DrJava. The debugger is turning out to be rather cool (for example, you can assign to any in-scope variable from the interactions pane) and, of course, JUnit is integrated.
To run a main method in class MyClass from the DrJava interactions pane you can just type this:
java MyClass
And you can give command line arguments as well:
java MyClass arg1 arg2
It works just like the command line.
bash-2.05b$ cd c:/cygwin/bin/csc207h/exer/e02/ bash-2.05b$ make javac -source 1.4 Atom.java make: *** [Atom.class] Error 255 bash-2.05b$The problem is that the directory containing javac (the Java compiler) isn't on your search path. To check, type "echo $PATH" to take a look at the value of the PATH environment variable. If your Java install directory isn't there, you'll need to add it to your path.
From Tim Smith (c3smitht@cdf)
An enumeration is a set of discrete values, such as HEARTS, CLUBS, SPADES, and DIAMONDS, or RED, GREEN, and BLUE. Pascal, C, and most other languages allow you to define new types of enumerations. Java doesn't (at least, not yet---Java 1.5 may include this feature). If you want enumeration-like behavior in Java, the best way is to:
An example is:
public class State {
public static final State STATE_START = new State();
public static final State STATE_WAITING = new State();
public static final State STATE_CONNECTED = new State();
public static final State STATE_END = new State();
public static final State STATE_ERROR = new State();
protected State() {
}
}
Now you can use the class's different values in a type-safe manner, as shown below:
public void setState(State state) {
// state is guaranteed to be one of the above States
if (state == State.STATE_END) {
...
}
else if (state == State.STATE_ERROR) {
...
}
else if (state == 5) { // won't compile!
...
}
}
public void foo() {
setState(State.STATE_ERROR); // perfectly fine
setState(1); // won't compile!
setState(new State()); // neither will this!
}
Googling for "Enumerated types in java" returns some good results, including how to make some pretty complicated enums. Unfortunately, switch statements can't be used with this method.
What is a commandline argument and how do I use them in my java program?
A commandline argument is an extra piece of information you provide
to a program or command you are executing by typing its name at a prompt.
For example when you type ls -l *.html at the
commandline -l is the first argument and *.html
is the second.
main method of myProgram.java
public static void main(String[] args) {
String firstArg = args[0];
String secondArg = args[1];
String thirdArg = args[2];
}
If this code were executed with the command
java myProgram first 2 anothertyped at the prompt, then
firstArg would be set to "first",
secondArg to "2" and thirdArg to
"another".
$Id: faq.html,v 1.1.1.1 2004/01/04 05:02:31 reid Exp $