Question
A fictional dictator leader sets a rule that from now on, a woman can only have multiple children if she gives birth to a boy
A fictional dictator leader sets a rule that from now on, a woman can only have multiple children if she gives birth to a boy - if she gives birth to a girl, she can no longer have any children. His purpose was to increase the rate of boys in order to use them in his army and make it stronger and bigger. Write a program in java, to see what would be the effect of this policy on the ratio of male: female over time, given people follow this rule.
Instructions:
1. You have to use Math.random() to define the gender of the child born.
2. For simplicity, we assume no twins/triplets, etc. are born.
3. The odds of having a boy are 40%, 50%, and 60%.
4. Your output should look like:
Results for odds 40%
Run# | Boys | Girls | Boy:Girl |
1 | 10,153 | 10,000 | 1:0.98493 |
2 | 9,788 | 10,000 | 1:1.02166 |
3 | etc.. |
6. You should provide the results for the three odds (40%, 50%, and 60%).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started