Programming
Assignment 0: |
|
|
|
Preparation
First. make sure that your machine has a Java 6 or Java 7 JDK installed. The commands
java -version
or javac -version
should work and both report with a version of Java 6 or Java 7 (reported as java version 1.6.* or 1.7.*).
If not, we suggest that you immediately download and install the latest
version of the Java 7 JDK.
Second, we recommend that you install latest available builds of DrJava and DrScala in "jar" form as listed on the local Rice DrJava/Drscala download page. You can load the abbreviated Java files into DrJava, compile and test them. These abbreviated files very closely correspond to what you will need to write in Scala. If you wish, you can also use DrJava to look at the corresponding ".java" files which contain lots of irrelevant boilerplate code required for Java execution. (Simply open the corresponding ".java" files created by the DrJava compile command.) But none of the extra code in the ".java" files is helpful in writing equivalent Scala because the Scala compiler automatically generates its own boilerplate code just the the functional language (".dj") level in DrJava. Submit this first assignment by simply sending it as an attachment to an email message to cork@rice.edu.
Write Scala source files equivalent to the two given functional Java (".dj") files. If you do this correctly, your Scala program will pass exactly the same unit tests as the given Java program.