MCS 178: Introduction to Computer Science II (Spring 2011)

Project 2: N-Body Simulation


Started: Tuesday 2/21 ;Due: 3/1, by the beginning of class

Overview

This assignment is also taken from the projects on the book's web site. In this case, the assignment is the N-Body Simulation. After reading through that page, be sure to read my comments below for some clarification and suggestions. I will discuss the underlying math and physics in class.

You should work on this project individually.

Specific tasks

  1. In order to do this program, you will need (1) the stdlib.jar library file provided by the book's authors; and (2) some other resource files you will need (such as the planets.txt file they talk about in their write-up) as well as some image and sound files to make things more interesting. The stdlib.jar file should be handled as explained in the next item; it is best to store the other resource files in your nbody folder.
  2. Download the stdlib.jar file and unjar it into the ~/introcs folder. You then need to configure the CLASSPATH environment so your shell knows how to find the class files in the stdlib library.
  3. The checklist for the N-Body Simulation gives useful tips on downloading from the COS 126 ftp site. You will need to download the contents of the nbody folder.
  4. I recommend you read through checklist for the N-Body Simulation, in particular the section titled "Possible Progress Steps", before embarking on the programming.
  5. Finally, if you enjoy this and want to add some enhancements, there are some suggestions in the N-Body Simulation assignment page as well as in the checklist for the N-Body Simulation.

What you must do/hand in

Running your program with the supplied data file planets.txt should result in the same behavior (including background image, images for the planets, and the 2001 midi file being played) as the animation at the bottom of the N-Body Simulation assignment page.

You must hand in your java source file NBody.java. You must also fill out the following readme.txt file. If you do any additional extra credit work, be sure to submit all files necessary to run your program, and give instruction for running it in the readme.txt file.

Gradesheet

We will use this gradesheet when grading your lab.

Submission

Use the procedure described in our instructions on submitting code document.