Programming Assignment FAQ


General FAQ

What's the difference between the assignment and the checklist? The assignment provides the programming assignment specification; the checklist provides clarifications, test data, and hints that might be helpful in completing the assignment.

Where can I find the course policies regarding submission, lateness, grading, and collaboration? The syllabus.

I would like to receive help from the course staff. Where can I find the schedules? Piazza is ideal for short technical questions; office hours are best for longer or more conceptual questions; the lab is great for help with debugging. For details, see the help section of the course website.

Do my programs need to handle every conceivable input? No. Your program must handle all meaningful inputs, but you need not worry about meaningless ones. For example, when testing RGBtoCMYK.java, we will always supply three command-line arguments that are integers between 0 and 255.

How will I access my work after it has been graded? You will login to codePost, a system designed by Princeton undergraduates to streamline our grading workflow. Your scores will also appear in Blackboard.


Submission FAQ

Can I submit assignments via email, hardcopy, or Snapchat? No, all assignments submissions must be done via Dropbox.

What's Dropbox? In this course, it means the web-based system that you will use to submit assignments. (The system predates the file hosting company with the same name.) Every assignment has its own submission link on the Assignments page. You will need to login using your OIT NetID and password.

When I login to Dropbox, my browser asks me whether I should accept a "security certificate." How should I proceed? Accept it permanently. We need to establish a secure connection so that you can submit assignments with reasonable privacy.

How do I successfully submit an assignment? Here is a short list of things to do:

You risk losing a substantial number of points for not following these instructions.

Can I correct my program and resubmit? Absolutely. There is no penalty for resubmitting files prior to the deadline.

When I submit a file, Dropbox reports Filename is not in list. Why is it rejecting my submission? Be sure the file has the correct name. Both the capitalization and .java extension are important. Also, DrJava creates backup files with a .java~ extension, so be sure that you don't submit these inadvertently. We recommend configuring your system to show the file extensions [OS X · Windows ].

How do I submit an assignment after the deadline? You must mark the checkbox in Dropbox that indicates that your work is incomplete. (Otherwise we will grade whatever is there at the time of grading.) When you are ready to have the assignment graded, unmark the checkbox.

I will be submitting late checkbox
There is no need to mark (and unmark) the checkbox if you are submitting before the deadline.

On assignments that allow partnering, how do my partner and I submit? One partner submits all of the required files and a full readme.txt file; the other partner submits a special abbreviated readme.txt.

On assignments that offer a Challenged for the Bored, how should I submit my solution? You shouldn't. They are solely for your own enrichment, not extra credit.


Check All Submitted Files FAQ

What exactly does the Check All Submit Files button in Dropbox do? It compiles and executes your program on the inputs specified in the assignment specification. It also runs two tools—Findbugs and Checkstyle—that automatically identify common bug patterns and style issues in Java programs.

Must I submit all of the required files to receive feedback? No, you will receive feedback on whichever files you submit.

What should the output look like, if there are no errors or warnings? Here is an example.

I receive various compiler errors and warnings. What does this mean? Your programs should compile cleanly, with no errors or warnings. Consult a staff member if you are unsure how to fix them.

I receive various Findbugs warnings. What does this mean? Findbugs is a program that looks for common bugs in your program. You should consider anything it reports an error (though there are occasionally false positives). Consult the course staff if you are unsure what an error message means or how to fix it.

I receive various Checkstyle warnings. What does this mean? Checkstyle is a program that looks for common style issues in your program. The appearance of a warning message does not necessarily lead to a deduction (and, in some cases, it does not even indicate an error). However, if you are learning to program in Java, you should strive to fix any issues that Checkstyle flags. You should pay particular attention to the custom checks, which are specialized to each program. Consult the course staff if you do not understand an error message or how to correct it.

I receive the Checkstyle error message Incorrect COS 126 header format. How do I fix this? At the top of each file, include a header in the specified format.

Will Checkstyle ever like me? No, Checkstyle is a computer program. However, as you gain programming experience, you'll get used to the myriad (and sometimes seemingly arbitrary) conventions that good programmers employ, and you will learn to like Checkstyle.

I receive various FAILED messages in the correctness tests. What does this mean? Your program does not meet the assignment specifications on the tested inputs. Failing any of these tests will lead to a deduction. (Passing all of these tests is a good sign, but does not guarantee that your program is 100% correct; we run a more substantial set of correctness tests when grading.) Consult the course staff if you do not understand the error message.

I receive the error Process took too long and was killed (output may be truncated). What could cause this? This usually means that the autograder could not complete in the allocated amount of time. One common cause is an infinite loop. Another possibility is that your program produces an enormous amount of output, perhaps because you left in a debugging statement.


readme.txt FAQ

What is a readme.txt file? It is a plain text file that contains a narrative description of your work. This is the first thing the grader will read. Each week, we'll provide a template readme.txt file. Be sure to answer any questions that it contains.

Which program should I use to edit the readme.txt file? Use DrJava. Be careful to save the file as readme.txt and not as a .java file. To open a plain text file in DrJava, select File -> Open; select the desired directory; choose All Files under File Format; and select the desired file. The readme.txt file must be a plain text file—Microsoft Word .doc or .docx formats and Mac TextEdit .rtf formats are unacceptable.

On assignments that allow partnering, what should go in the partner's readme.txt file? The assignment will provide a special abbreviated readme.txt template.


Header FAQ

What is the proper format of the header for Java programs? Here is an example for an assignment with no partner.

/******************************************************************************
 *  Name:    Kevin Wayne
 *  NetID:   wayne
 *  Precept: P01
 *
 *  Partner Name:    N/A
 *  Partner NetID:   N/A
 *  Partner Precept: N/A
 * 
 *  Description:  Prints 'Hello, World' to the terminal window.
 *                By tradition, this is everyone's first program.
 *                Prof. Brian Kernighan initiated this tradition in 1974.
 *
 ******************************************************************************/
The header must appear at the very beginning of the Java file and follow the formatting above (e.g., the first line consists of the forward slash character, followed by 78 asterisks). You are free to add additional information after the description section of the header (such as instructions for compiling, executing, and listing any dependencies) but this is not required.

How strictly must I adhere to the formatting requirements? You should strive to match it exactly. We recommend cut-and-pasting the above template. However, if you use only 75 asterisks on the first line (instead of 78), that will be accepted.

What is the format of the header for the readme.txt file? It is the same as for Java programs, except no description is required.

/******************************************************************************
 *  Name:    Robert Sedgewick
 *  NetID:   rs
 *  Precept: P02
 *
 *  Partner Name:    Kevin Wayne
 *  Partner NetID:   wayne
 *  Partner Precept: P01
 ******************************************************************************/

May I use non-ASCII characters in the header? Yes. However, if you use non-ASCII characters, they must be Unicode and encoded using UTF-8.


Java FAQ

Which Java programming environment should I use? For simplicity, we recommend the lightweight IDE DrJava If you use our autoinstaller [ Mac OS X · Windows ], then everything should be configured and ready to go. If you prefer use another IDE (such as Eclipse), that's fine—however, it will be your responsibility to make sure you can use command-line arguments, read from standard input, redirect standard input and output, and add stdlib.jar to your Java classpath.

How can I download a program from the textbook? The booksite contains links to all of the Java programs in the textbook. Each link goes to an HTML file (such as UseArgument.java.html) that is suitable for display in a browser. You can copy-and-paste the code into DrJava as needed, with appropriate attribution. The HTML file contains a link to the Java source file (such as UseArgument.java); you can right click this link and save the file to your computer.

How should I read in user input? It depends on the assignment. If the assignment specifies command-line arguments, your program should accept command-line arguments; if the assignment specifies standard input (starting on Assignment 2), your program should accept input from standard input. You will receive a significant deduction for not following these directions.

May I use (advanced) features of Java that have not yet been covered in the course? No, your code should use only the Java language features previously introduced in the course. For example, you may not use an if statement or a for loop on Assignment 0.


Style FAQ

How should I format my code? Here are some recommended style guidelines. Below are some that are particularly important (and for which you risk losing points if you ignore).

How should I compose a program?

How should I comment my code? Below are some that are particularly important (and for which you risk losing points if you ignore).


Downloading Helper Files FAQ

How can I extract the helper .zip file associated with an assignment? Beginning with Assignment 2, we include associated data files that are useful for testing. They are bundled together in a .zip file, which you will need to extract: