Skip to content
Jinho D. Choi edited this page Jan 21, 2015 · 8 revisions

Java Development Kit (JDK)

  • Download the latest version of JDK from here and install.
  • Make sure the version is 1.8.x or higher by typing java -version on a terminal.

Eclipse

  • Download the latest version of Eclipse from here and install.
  • Launch Eclipse by double-clicking the icon.
  • If it prompts to specify a working directory, keep the default one (Workspace).
  • If it shows a Welcome tab, close the tab.
  • Create a new project CS325 by choosing File -> New -> Java Project.
  • Create a package utils by right-clicking [CS325] -> New -> Package.
  • Create a class MathUtils by right-clicking {utils} -> New -> Class.
  • Add the following methods to the MathUtils class:
static public double divide(int numerator, int denominator)
{
    return (double)numerator / denominator;
}
	
static public void main(String[] args)
{
    System.out.println(divide(1, 2));
}
  • Run the program by choosing Run -> Run.
  • If you see 0.5 on the console, your program is successfully run.

JUnit Test

  • Right click on the CS325 project and choose Build Path -> Add Libraries.
  • Choose JUnit and add JUnit 4.
  • Create a class MathUtilsTest under the utils package.
  • Add the following method to the MathUtilsTest class.
  • Make sure to include the @Test annotation.
@Test
public void divideTest()
{
    assertEquals(MathUtils.divide(1, 2), 0.5, 0);
}
  • Run the test by choosing Run -> Run.
  • If you see a green bar, your test is passed.

Quiz

  • Login to lab0z.mathcs.emory.edu.
  • Create a directory quiz0 under the cs325 directory.
  • Put MathUtils.java and MathUtilsTest.java under cs325/quiz0.
  • If you are using a Windows machine with no command-line tools:
  • Use an FTP client (e.g., FileZilla) to upload your files.
  • If you are using a Mac/Linux machine:
  • Run the following command (replace yourID with your mathcs ID).
rsync -avc MathUtils.java MathUtilsTest.java yourID@lab0z.mathcs.emory.edu:~yourID/cs325/quiz0/

Artificial Intelligence

Instructor


Emory University

Clone this wiki locally