User Tools

Site Tools


lab2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
lab2 [2017/01/14 17:20] francklab2 [2018/01/02 22:03] (current) franck
Line 1: Line 1:
 +====== Lab 2 ======
 +
 +
   * In your home directory create a directory named .jpf (note that the name of the directory starts with a dot).     * In your home directory create a directory named .jpf (note that the name of the directory starts with a dot).  
   * In the created directory, create a file named site.properties with the following contents.   * In the created directory, create a file named site.properties with the following contents.
Line 12: Line 15:
 import java.util.Random; import java.util.Random;
  
-public class RandomFraction  +public class RandomFraction { 
-+  public static void run() { 
- public static void run()  +    Random random = new Random(System.currentTimeMillis()); 
- +    System.out.println(1 / random.nextInt(1000000)); 
- Random random = new Random(System.currentTimeMillis()); +  }
- System.out.println(1 / random.nextInt(1000000)); +
- }+
 } }
 </code> </code>
Line 24: Line 25:
   * In the created directory lab2, create the class RandomFractionTest with the following content.   * In the created directory lab2, create the class RandomFractionTest with the following content.
 <code java> <code java>
-public class RandomFractionTest  +public class RandomFractionTest { 
-+  public static void main(String[] args) { 
- public static void main(String[] args)  +    RandomFraction.run(); 
- +  }
- RandomFraction.run(); +
- }+
 } }
 </code> </code>
Line 68: Line 67:
 ====================================================== search finished: 1/14/17 12:06 PM ====================================================== search finished: 1/14/17 12:06 PM
 </code> </code>
-  * To the file RandomFractionTest .jpf add the following.+  * To the file RandomFractionTest.jpf add the following.
 <code> <code>
 cg.enumerate_random=true cg.enumerate_random=true
lab2.1484414401.txt.gz · Last modified: 2017/01/14 17:20 by franck

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki