GSLM53300 System Simulation Spring 08/09 − 1 − Assignment #1 ...

5 downloads 42 Views 19KB Size Report
Spring 08/09. − 1 −. Assignment #1. Follow Steps 1-4 below to install NetBeans and run Java programs for the assignment. 1. NetBeans is a free desktop Java ...
GSLM53300

System Simulation

Spring 08/09

Assignment #1 Follow Steps 1-4 below to install NetBeans and run Java programs for the assignment. 1.

NetBeans is a free desktop Java application developer that can be downloaded from web. The version NetBeans IDE 6.0 is used in this course. Students can ask the instructor for help if he fails to get NetBeans on web. Double click the icon of the NetBeans installation program (jdk-6u3-nb-6_0-windows.exe for NetBeans IDE 6.0) and follow the instruction to install NetBeans (which also includes Java).

2.

Download and unzip program.rar to get the Java programs for the assignment. Students can put the unzipped directory program in the Desktop of their computers, though the exact path (i.e., location) of the directory is not essential.

3.

The following procedure uses the project Die_tossing to explain how to open and run a java program in NetBeans. The same procedure is applicable to other projects and java programs. 3.1. After the installation, double click the NetBeans icon to turn NetBeans on. 3.2. Open project Die_tossing in NetBeans (choose the correct project through Open Project option in the menu bar of NetBeans). 3.3. 3.4.

Double click (the icon of) project Die_tossing in the Project Window to see sub-directories of project Die_tossing. Double click sub-directory Source Packages 1 in the Project Window to see

3.5.

sub-directory die_tossing. Double click sub-directory die_tossing in the Project Window to see Java file

3.6.

Die_tossing.java. Double click Die_tossing.java to open it.

Actually there is another way to open Java file Die_tossing.java. After project Die_tossing has been opened in step 3.2, open file Die_tossing.java through the Open File option in the mean bar of NetBeans. Note that the sub-path of the file within the project directory is Die_tossing/src/die_tossing/Die_tossing.java. 4.

Upon opening a Java file, choose option Build/Compile to compile; option Build/Build Main Project to build; and option Run/Run Main Project to run the file. The three operations can be executed by pressing function keys F9 (Compile), F11 (Build), and F6 (Run). The three steps can actually be combined into one by directly running the file.

1

Double click sub-directory src instead if there is no Source Packages.



1



GSLM53300

System Simulation

Spring 08/09

#1. The following questions are related to Project Die_tossing. (a). Simulate tossing a fair die five times by running program Die_tossing.java. Compile, build, and then run the program three times (i.e., a total of 15 tosses is made in the three replications).

Report the results.

Do the runs give different results?

(b). Change the (Java) statement “(n