Monday, October 10, 2011

CHALLENGE:Java Tut 30-Array Elements As Counters

The following is a challenge for new developers that have completed:
 Java Tutorial - 30 Array Elements As Counters by theNewBoston
 


B.A.M.F Challenge:
B.A.M.F Challenges & why you want to always at leas try them explained Here:http://bit.ly/ogivqe
Difficulty: 1/2
 Create a java console program using arrays and for loops that simulates a 6 sided die being tossed 1000 times. Then print the amount of times it fell on each side of the die to the console. Your console output should look something like this: 
Face      Frequency
1                182          
2                 220         
3                134          
4                278          
5                169         
6                188          



CHALLENGE!!
(Before starting any of the challenges always declare a class and a main method unless told otherwise)
 Difficulty:★1/2
1.Create a Random variable and name it rand
2.Create a int array that holds 7 int's, name it freq. 
3.Create a for loop that loops 1000 times.Each time it loops it should:
       *++freq[1+rand.nextInt(6)];
4.Below the for loop print a header that reads "Face        Frequency"
5.Create another for loop:
  Start you're "counter" at 1, the loop should continue as long as face is less than the length of the freq array , increment by 1 , each time it loops it should :
                   *Print the index , a few spaces and the value of the index position.(See the example in the                      B.A.M.F example if you're confused.

View the video tutorial: http://bit.ly/nFzFhL 

1 comment:

Mary Brown said...

Java EE article is practical oriented and real time examples. How Java EE address the enterprise development is very important. for that you need a practical orieneted Java Training you need.

Online Java Training
Online Java Training from India
Java Training Institutes in Chennai
Java Training in Chennai
Java Training

Post a Comment

 
;