In this course, you will be submitting most of your assignments electronically. For Assignment 1, we will be testing your work automatically, using a program that checks the correctness of your code. Read the following rules carefully, and follow them.
We apologize for having to be so strict, but remarking takes a huge amount of time per assignment -- and with so many students, it becomes intractable.
If you violate any of the following rules then you may get a zero on some or all parts of the assignment, WITH NO APPEAL ALLOWED. (Please notice that you have to go out of your way to violate them!)
Put only one public
class in each
.java
file.
Submit your .java
files (the source code), not
your .class
files. Do NOT rename your
.class
file to make the electronic submission
work.
Don't ever use package
statements, even
if your favourite IDE inserts them automatically. Delete them
if they appear.
Capitalization matters in Java, including in filenames. This
means that class names must match the filenames exactly. For
example, if your class is called AssignmentZero
,
your file must be called AssignmentZero.java
,
and not assignmentzero.java
or
Assignmentzero.java
. Use the capitalization
asked for in the handout and starter code.
For Assignment 1, you will not be marked on style. However, you should start developing good style habits early, because for the next two assignments you will likely be marked on some or all of the following points.
Use Java style conventions for your method and variable names (start with a lowercase letter, then use lowercase except for the beginning of a new word within the name).
Write a good comment for each class, each instance variable, each static variable, and each method.
Your method comments must mention what, if anything, the method returns, and the purpose of each parameter. The comment must be grammatically correct.
The variable comments should be brief and just say what the variable is used for. They should also be clear and grammatically correct.
Each line must be less than 80 characters long including tabs and spaces. Beware of "soft returns" -- some word processors, like WordPad, wrap lines automatically. If you use such a program, make sure that you press the return key yourself.
DrJava tells you what column you're in. Look in the lower-right corner.
Use a tab width of 2 (DrJava's default), if you use tabs at all. The best way to make sure your program will be formatted correctly is never to mix spaces and tabs -- use only tabs, or only spaces. If you use a tab width of less than 2, it is your responsibility to make sure that your lines are shorter than 80 characters when we print your program. DrJava is set up at school to use a tab width of 2, and you can do that at home, too, in almost all IDEs.
Put a blank line before every comment that appears on a line by itself.
Put a blank space before and after every operator. For example, the first line below is good but the second line is not:
boolean b = 3 > x && 4 - 5 < 32; boolean b = 3>x && 4-5<32;
When breaking up a long line break it before an operator, not after. The first example below is good but the second is not:
boolean b = "Hello".charAt(3) + 3 > x && Integer.parseInt(s) < 32; boolean b = "Hello".charAt(3) + 3 > x && Integer.parseInt(s) < 32;
Place opening brace on the same line as the method/class header. The first example below is good, but the second is not:
public void blah() { ... } public void blah() { ... }