COS 126Assignment 0 Programming Assignment Due: 11:59pm

The purpose of this assignment is to familiarize you with the mechanics of preparing and submitting assignment solutions. Your goal this week is to learn to use JEdit for editing programs, javac for compiling them, java for executing them, and Whiteboard for submitting them.

Hello, World.  The purpose of this step is to set up your computer for developing Java programs.

• Working at home. If you want to work on your home computer, follow the step-by-step instructions for your operating system: Windows, OS X, or Linux. If you're on the Princeton network, then you can download the files faster via our ftp server. If you are familiar with your operating system, you should be able to finish this part on your own. If you are hesitant, bring your laptop and a network cable to Friend 017. The lab is staffed in the evenings with knowledgeable TAs who can assist you. Don't be afraid to ask for help.

• Working in a public cluster. If you prefer to work in one of the OIT public clusters follows the instructions for the Windows, Mac OS X, or Unix depending on your which type of computer you will be using, but skip the steps that involve installing software. For text editing, we recommend JEdit for Windows, ProjectBuilder for Mac OS X, and xemacs for arizona. If you are hesitant, work in Friend 016 or 017. The labs are staffed in the evenings with knowledgeable TAs who can assist you. Don't be afraid to ask for help.

Programming.  Your job is to write two short programs. We'll assume that you've already created, compiled, and executed HelloWorld.java by following the instructions in the previous part of the assignment. Before completing this part, you should read Intro to CS Sections 2.1 and 2.2.

1. Write a program StdGaussian.java that prints out a random value from a standard Gaussian (normal) distribution. One way to simulate a standard Gaussian is via the polar form of the Box-Muller formula
Z = sin(2 π V) (-2 ln U)1/2
where U and V are real numbers between 0 and 1 generated by Math.random(). Note that Math.PI is the mathematical constant &pi,  Math.log(x) is the natural logarithm of x, Math.sqrt(x) is the square root of x and Math.sin(x) is the sine of x radians.

2. Write a program Ordered.java that reads in three integer command line arguments, x, y, and z. Create a boolean variable b whose value is true if the three values are either in strictly ascending order (x < y < z) or in strictly descending order (x > y > z), and false otherwise. Print out the variable b.

Submitting the programs.  Once you have HelloWorld.java, StdGaussian.java and Ordered.java working, submit them via the Web. To do this, launch your favorite browser and go to the COS 126 web page:

`http://www.princeton.edu/~cos126`
choose Assignment Submission, and follow the instructions provided. Be sure to hit the Run Script button to check your program against our Java compiler. It should compile without errors or warnings; if not, fix the problem and resubmit it. To submit a file, you must be registered for the course and know your NetID and OIT Email password. You will receive an automated email receipt confirming your submission.

Browsing the course website.  The final part of the assignment is to browse the COS 126 Web pages. The address is:

`http://www.princeton.edu/~cos126`
Cruise around the COS 126 Web site; it is essential that you understand what's where and how to get to it. Be sure to fill out the online questionnaire. Also make sure you find the "Assignment 0 Checklist" page, and also be sure to read the COS 126 Collaboration Policy and answer the related questions in your readme file.