Resources


Resources

Code Style Guidelines

Here

Google Groups

The CS 2110 Google group is a public forum for discussing questions about the assignments. The course staff monitors this group regularly, so this is a great way of getting help and interacting with the course staff. An extra advantage of using the group is that everyone else can benefit from your question as well. Anyone can visit the group and read previous questions here . To ask a question, subscribe to the group with a Google account and post a question via the web interface, or send an email to cornell-cs2110@googlegroups.com

If you know the answer to a question, feel free to post a reply yourself, but please avoid giving away any hints on the homework or posting any part of a solution. This will be considered a violation of Academic Integrity. Generally, rough algorithms or non-solution-specific code fragments are OK if you need them to illustrate a point.

Quizzes

11/03/10 Quiz 3 and the solutions have been posted.
9/28/10 Quiz 2 and solutions have been posted.
9/14/10 In-class Quiz 1 and solutions posted.

Section Examples

[Examples for the section will be posted here].

Setting up Java

In CS 2110, you'll be using an integrated development environment (IDE) called Eclipse to develop and debug your applications, which will be coded in the Java 6 Standard Edition (Java SE 6) platform, as released by Sun Microsystems Inc.  Java SE 6 includes a Java Development Kit (JDK) as well as the Java Runtime Environment (JRE). Java 5 will also be sufficient if for some reason you prefer that version.  The way to think about all of this is that the IDE is the "digital dashboard" and code editor for writing code and performing commands like compiling it, pulling in standard libraries, identifying problems and fixing them.  Under the covers, the IDE is giving you a kind of friendly interface to the JDK, which has all sorts of standard libraries.  And the JDE is like a computer (sort of a computer within your computer) that can run the resulting code.

When you download and install Eclipse, as long as you select the "Java Personality" for the package, you can also download and install the JDK and JDE all in one monster file.  We mention the personality because Eclipse can also be used to develop code in other languages like C++, and it can be used to create applications that run on the desktop (our kind), on servers (we won't do this), as new libraries, etc.  If you get confused and use the wrong personality, Eclipse will complain but nothing horrible will happen and you can usually poke around until you get to the home page, then select the personality you really wanted (Java) and then you should be in better shape.  Each of your homework assignments will be a separate Eclipse "project", but you can use the results from one assignment as a basis for the next, and in fact we'll often do so.

Some cs2110 students installed Java on their machines a while ago and try to cut corners and skip this install step.  That would be a mistake.  If you are using a version of Java prior to 5, such as J2SE 1.4, you must upgrade. We will be using many new features that were introduced in Java 5, such as generics, autoboxing, and typesafe enums. These newer features are described in the following sources:

To find out which version of the Java Runtime Environment (JRE) you are running, open a command window (in Windows, Start > Run... and type cmd, and in Mac OS X, Applications > Utilities > Terminal) and type java -version at the command prompt:

C:\>java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)

This says I have version 6 installed (6 and 1.6 are synonymous).

If you are on a PC running Windows and have never installed a version of the Java Development Kit (JDK) on your machine, you probably don't have it. If you are on a Mac, you probably do. To find out, type javac -version:

C:\>javac -version
javac 1.6.0_07

If you get an error message or the version is earlier than 1.5, you must (re)install the JDK.

Installing the JDK

The easiest way to install the JDK is to jump down to the link for installing Eclipse, below, and follow that.  Then select the option for installing the JDK and JDE as part of the Eclipse install.  In one easy (but slow) download, you'll have everything you need.

If you want to install just the JDK, read the remainder of this section.

The JDK is already installed in CIT and ACCEL labs. However, installing it own your own machine will greatly facilitate your work. Please note that you should double check your work in a public lab, as privately owned machines occasionally exhibit different behaviors.

Windows and Unix

To download the JDK, visit Sun's Java web site and download and install JDK 6 Update 7.

Mac

As of Fall 2005, Sun does not support Java for Macs. However, there is support available from Apple. You must be running Mac OS X version 10.4 (Tiger) or later, which comes with the JDK version 5 already installed.

If you have a 64-bit Intel-based Mac running Mac OS X 10.5 (Leopard), there is a version of Java SE 6 available from Apple. If you wish to upgrade, visit Apple's Java web site and download and install Java for Mac OS X 10.5, Update 1. After installing, run Applications > Utilities > Java > Java Preferences. Drag the newly installed version of Java to the top of the list under Java Application Runtime Settings. Click Save.

Compiling and Running from the Command Line

Compiling

Say your main class is MyProgram and it is contained in the source file MyProgram.java. If it is not in a package, navigate to the folder containing MyProgram.java and type javac MyProgram.java.

If it is in a package (say myPackage), the source should be in a folder called myPackage. Navigate to the folder containing myPackage and type javac myPackage/MyProgram.java.

Running

From the same folder you compiled from, type java MyProgram <program arguments> if it is not in a package, and java myPackage.MyProgram <program arguments> if it is.

Specifying a Classpath

Sometimes you may need to inform Java where to find auxiliary classes. You can do this with the -cp option to the java command. Supply a sequence of folders telling Java where to look for classes, separated by : (Mac) or ; (Windows).

Brushing Up

For students with limited Java experience, we recommend the online notes from CS 1130 (formerly 101J), Transition to Object-oriented Programming as a refresher. This is a self-paced course consisting of several modules that you can go through at your leisure.

More Ways To Catch Up


Support Services

Academic Excellence Workshops

The Academic Excellence Workshops (AEW) offer an opportunity for students to gain additional experience with course concepts in a cooperative learning environment. Research has shown that cooperative and collaborative methods promote higher grades, greater persistence, and deeper comprehension. The material presented in the workshop is at or above the level of the regular course. We do not require joining the AEW program, but do encourage students to join if they are seeking an exciting and fun way to learn. The AEW carries one S/U credit based on participation and attendance. The time commitment is two hours per week in the lab. No homework will be given. This is a wonderful opportunity for students to seek extra help on course topics in a small group setting.

Your fellow undergraduate students, who are familiar with the course material, teach the sessions with material that they prepare. The course staff provides guidance and support but do not actually teach the AEW course content or any session. A representative from the AEW program will be speaking about the program and registration procedures in lecture.

One of your TAs will be designated as the AEW liaison for CS 2110. Watch the announcements to find out who.

See the AEW webpage for further information.