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.
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 describe and some image and sound files. It is best to store these files in your Eclipse project, since that way we will have access to your full environment when you hand in your project. So, right-click on Project3 and create two directories called lib
and resources
.stdlib.jar
and configure the class path in lab, but I am including the instructions anyway, for completeness and reference.) Download the stdlib.jar
file and copy it into the lib
folder. You then need to tell Eclipse about this library file by configuring your build path. To do this, right-click on Project3 in Eclipse and select Build Path > Configure Build Path... In the window that pops up, you should be in the Libraries tab of Java Build Path; if not, then go there. Then click on the Add Jars... button and choose stdlib.jar in the lib directory under Project3.nbody
folder there, and then copy those files into the resources
directory you created in step 2 above. Alternatively, you can download the nbody.zip, expand it by double-clicking in the Finder, and then copying it to the resources directory.<
operator) in order to read the planets.txt
file as StdIn
. I would suggest you instead do all your work in Eclipse. In order to do this, you can provide the name of the input file as a third command argument after the finishing time and time step, without using <
. Your program then needs to start with a little extra code to open up the specified file and use it as StdIn
. I am providing that code for you in this starting version of NBody.java. I will talk about this in lab.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 page. It should also print out the description of the ending state as shown there; this numerical information helps check that your simulation really is correct, as opposed to just looking plausible. You must also fill out our version of the readme.txt file (not the Princeton version on the textbook site). If you do any additional extra credit work, be sure to note it in that file.
We will use this gradesheet when grading your lab.
Use the same procedure to submit your code as in the previous project. Submit the zip file via Moodle. This is described in our step by step instruction on submitting code. Be sure to select 2016 s-mcs-178-001, which is your lecture section.