CSCI 135 Online |
% java DoubleOrNothing 1000 100 After 1 bet(s), total: 200.0 After 2 bet(s), total: 400.0 After 3 bet(s), total: 800.0 After 4 bet(s), total: 1600.0 Number of bets: 4 Final amount: 1600.0 % java DoubleOrNothing 12345.67 13.00 After 1 bet(s), total: 26.0 After 2 bet(s), total: 52.0 After 3 bet(s), total: 104.0 After 4 bet(s), total: 208.0 After 5 bet(s), total: 416.0 After 6 bet(s), total: 832.0 After 7 bet(s), total: 1664.0 After 8 bet(s), total: 3328.0 After 9 bet(s), total: 6656.0 After 10 bet(s), total: 13312.0 Number of bets: 10 Final amount: 13312.0 % java DoubleOrNothing 0.99 0.25 After 1 bet(s), total: 0.5 After 2 bet(s), total: 1.0 Number of bets: 2 Final amount: 1.0 % java DoubleOrNothing 100 1000 Number of bets: 0 Final amount: 1000.0 % java DoubleOrNothing 1000.00 1000.00 Number of bets: 0 Final amount: 1000.0 |
% java Pattern 4 4 *.*.*.*. .*.*.*.* *.*.*.*. .*.*.*.* % java Pattern 5 2 *.*.*.*.*. .*.*.*.*.* % java Pattern 0 2 % java Pattern 2 -2
Possible progress steps:% java BoyAndGirl Congratulations! You have 3 children. % java BoyAndGirl Congratulations! You have 6 children. % java BoyAndGirl Congratulations! You have 2 children.
As T increases, we expect the average number of children per family to converge. Use BoysAndGirls to formulate a hypothesis as to what this average is. Run BoysAndGirls with T = 1, 10, 100, 100000 and 1000000 to watch it converge to a sufficiently accurate estimate. Include your experimental results and hypothesis in the header portion of BoysAndGirls.java.% java BoysAndGirls 2 Average: 6.0 children to get at least one of each sex. Number of families with 2 children: 0 Number of families with 3 children: 0 Number of families with 4 children: 0 Number of families with 5 or more children: 2 Most common number of children is 5 or more. % java BoysAndGirls 10 Average: 3.5 children to get at least one of each sex. Number of families with 2 children: 2 Number of families with 3 children: 3 Number of families with 4 children: 3 Number of families with 5 or more children: 2 Most common number of children is 3. % java BoysAndGirls 100 Average: 3.19 children to get at least one of each sex. Number of families with 2 children: 44 Number of families with 3 children: 24 Number of families with 4 children: 16 Number of families with 5 or more children: 16 Most common number of children is 2.
Page last updated: January 21, 2015