Friday, October 7, 2011

CHALLENGE:Java Tut 26-Random Number Generator

The following is a challenge for new developers that have completed:
Intermediate Java Tutorial - 26 -Random Number Generator by theNewBoston

B.A.M.F Challenge:
B.A.M.F Challenges & why you want to always at leas try them explained Here:
Difficulty: ★ 1/2
 Create a java console program that simulates rolling  a standard 6 sided die(the single form of dice)  10 times and print out the results in the console with a space. The results should look something like this:  
3 7 2 2 1 ect... up  to 10

(Before starting any of the challenges always declare a class and a main method unless told otherwise)
1. Declare a new Random variable and name it "dice"
2. Declare a int variable and name it "number"
3. Create a "for" loop that will loop through 10 times before stopping.
          (hint: initialization; termination; increment
4. Inside the for loop set the number var to equal a random number between 1-6(hint: "dice.")
5.Print the random number variable + a space (" ")
( If you dont add the space when you run it all youre numbers will be in one jumbled line.)

View the video tutorial:

No comments:

Post a Comment