Monday 4-12
Major difference between using an array and an ArrayList in the Poker Project
Random Class javaDoc
ArrayList javaDoc
Integer Class javaDoc
for each loop
New Project : Stats<lastname>
Create a class named stats1
private data - ArrrayList of Integers named data .
The constructor will fill data with ten random Integers between 0 and 100. Seed the generator with 6.
inspection of data should have the following values.
27
73
51
76
78
100
85
86
74
1
Submit the constructor
write an outputData method that outputs the values in data. The output should be exactly what is above. This method must use a for each loop!
submit outputData method
Write a sumData method that returns the sum of all values in data as an int. Must use a for each loop.
submit the sumData method
AP-HK - sortData method submission
Tuesday
Missing sortData submission from Wi and Ov
Modify the constructor to do the following:
Randomly determine the size of the data ArrayList which is filled with Integer object containing values between 0 and 100 inclusive. The data ArrayList size must be between 101 and 120 inclusive. Do not change the seed. Submit the modified constructor.
Create a Stats1Main class which will only have a main method. The main method will create 19 Stats1 objects and output the following for each (you may add methods to the Stats1 class):
n : the number of objects in the ArrayList
mean : the mathematical average of the Integer object values.
Sample output - you should similar output - make sure you get an n=101 and n=120:
n =117 mean=48.162393162393165
n =102 mean=46.470588235294116
n =107 mean=46.373831775700936
n =114 mean=47.228070175438596
n =115 mean=47.6
n =104 mean=46.73076923076923
n =116 mean=47.922413793103445
n =111 mean=47.16216216216216
n =107 mean=46.373831775700936
n =112 mean=47.63392857142857
n =102 mean=46.470588235294116
n =106 mean=46.56603773584906
n =117 mean=48.162393162393165
n =105 mean=46.75238095238095
n =111 mean=47.16216216216216
n =115 mean=47.6
n =112 mean=47.63392857142857
n =116 mean=47.922413793103445
n =104 mean=46.73076923076923
submit the Stats1Main class main method.
Quiz over Monday and Tuesday - you will NOT be able to look at previously written code. Make sure you understand completely what is going on in the Stats1 class.
Wednesday
Quiz over Monday and Tuesday - Due midnight tonight.
Location class submission
Board class Submission
Thursday
Java
After completing the work from Wednesday do the following :
1. Remove the outputStreet() statements. We don't want to see the movement.
2. Run the simulation ten times.
3. Modify the Amain main method to calculate the average number of steps taken to leave the city.
4. Required sample output (format) - you will get different numbers but is should look similar. Make sure the average calculation is correct - verify with a calculator!
Out of the city in 52 steps
Out of the city in 20 steps
Out of the city in 14 steps
Out of the city in 14 steps
Out of the city in 8 steps
Out of the city in 36 steps
Out of the city in 28 steps
Out of the city in 18 steps
Out of the city in 8 steps
Out of the city in 8 steps
n=10 sum=206
For an average of 20.6
Submit the modified main method.
Java - HK
You will do the same except the main method will take to arguments - the number of times to run the simulation and the size of the city. Starting your Amain main method (mine is called Amain2) it should look like this :


Your output should look like this for a c (number of executions) of 20 and a city size of 30 :

Out of the city in 423 steps
Out of the city in 268 steps
Out of the city in 105 steps
Out of the city in 188 steps
Out of the city in 108 steps
Out of the city in 170 steps
Out of the city in 117 steps
Out of the city in 313 steps
Out of the city in 102 steps
Out of the city in 149 steps
Out of the city in 775 steps
Out of the city in 183 steps
Out of the city in 59 steps
Out of the city in 90 steps
Out of the city in 387 steps
Out of the city in 148 steps
Out of the city in 180 steps
Out of the city in 329 steps
Out of the city in 312 steps
Out of the city in 332 steps
n=20 sum=4738
For an average of 236.9
City Size is 30
Submit the modified main method.
Friday
From previous week
Monday 3-29
Submit test code
Check email for code test pt 1
After making corrections to code test pt 1 start on the following:
All
Create Deck
Output Deck
Cut Deck at location 29
Output Deck
Cut Deck at a random location (output the location)
Create a new Deck and randomly Shuffle
Output Deck
Random Shuffle
Output Deck
Submit for the Deck Class
Submit for the Deck2 Class
AP - HK
Create a Game class consisting only of a main method which does the following:
Create a Deck (deck2) - add a constructor that takes five cards.
Shuffle Randomly four times
Deal four poker hands and output the hands to the screen.
Submit the main method.
Tuesday
Continue with Monday's work
Wednesday
PokerPlayer Class
private data : Person (import) and a PokerHand
Constructor : Person's name
Write appropriate methods
Suggest methods in class
Updated:
Thursday, April 15, 2010 7:48 AM