Q: What is the best way to generate a random number?
A: You should use Random Class with a seed to generate a random number. Take a look at the class document or Project 3 for more information.

Q: What is seed and how should I get seed from command prompt arguments?
A: Seed is a number that you will pass to Random Class constructor to make sure you will get the same sequence of random numbers. It is useful to check the output of your program against a test-case. Take a look at Project 3 for more information.

Q: Which IDE should we use for this Lab?

Q: Is there any styling criteria in this course?
A: Yes, follow this address for more information: http://www.cs.fit.edu/~ryan/cse2010/style.html

Q: What is Check-Style and how can we add its plugin to Eclipse?
ACheckstyle is an open source development tool to help programmers write Java code that adheres to a coding standard. 
To Install plugin:
  1. in Eclipse goto help->Install new Software
  2. add a new installation site
  3. Enter this url: http://eclipse-cs.sf.net/update
  4. Enter a name and click OK
  5. Select Check-style and install plugin (review and accept terms of license)
  6. During installation, if Eclipse complained about installing plugin from insecure source, just let it install.
  7. Restart Eclipse
To Configure Plugin:
  1. Goto Window->preferences
  2. Select CheckStyle from left panel (if there are more than one, repeat steps for each of them)
  3. In Global Check Configurations section, select new
  4. Select Remote Configuration from the type list
    (Alternative: Download the xml file, select 
    External Configuration file, and choose the file you've downloaded) 
  5.  Enter a proper name
  6. enter this url as location: http://cs.fit.edu/~ryan/style/cse1002_checks62.xml
  7. Close the dialog
  8. Select new configuration from the list
  9. click "set as default"
To Check the Style:
  1. Right-click on the filename or in the source editing window
  2. Goto Checkstyle
  3. select "check code with checkstyle"

Improve the formatter & ease your work (Optional):

  1. Window > Preferences > Java > Code Style > Formatter >
  2. Hit Edit
  3. Goto Indentation Tab, and under General Settings change the Tab Policy to "Spaces Only"
  4. Goto White Space Tab, and under Insert Space section: Declarations > Methods
  5. On the bottom enable "before opening parenthesis"
  6. Hit OK to save the settings
  7. In order to test: Select Java code, right click, then Source > Format
  8. Now check with checkstyle again

Q: What is refactoring? 
A: "disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior" from http://en.wikipedia.org/wiki/Code_refactoring

Q: How can I configure code formatter in Eclipse?
To configure code formatter you need to open window->preferences in eclipse, then select Java->Code Style->Formatter. You can create your own profile or use this XML file that set up to meet styling criteria of this course. Just download the file, then click on import, go to the location that you've download the XML file and import it. you can click on Edit and change any of the settings to meet your expectation in code formatting.

Q: How do I format on save? 
A: Go to Window->Preferences in eclipse, then go to Java->Editor->Save Actions.  Check the boxes for Perform Selected Actions on Save and Format source code.  You probably want all lines.  If you want "clean-up" on save, click on Additional Actions, and configure it to the same settings as the Java->Code Style->Clean Up.

Q: How can I configure code clean-up in Eclipse?
A: Configuring code clean-up is exactly the same as code formatter except you will find setting in Java->Code Style->Clean Up. We prepared another XML for (Code Clean Up XML) for you so you can import and use it to fix most of the styling problems of your programs.

Q: Where can I find format specifier's format in Java documentation?
A: Internally, printf and other methods will use class Formatter to generate formatted output. Refer to Java documentation for this class (click on the link above).

Q: How can I use StdDraw or Picture class for a projects?
A: Download StdDraw.jar or Picture.jar, and add it to your project (by import, dragging, or copying it to the project folder). Do not add it to src folder. Then right-click on the file and goto Build path->add to build path.