Our program is designed to simulate a breeding population of organism and observe the success of two characteristics. This characteristic is present in the population only when the organism posses two recessive alleles, we assume it is a detrimental one because these characteristics pose the greatest threat to endangered breeding populations in the wild and in controlled environments.
To simulate a breeding population, we at first give the user the option to create a number of organisms, male and female, to begin the population. The program also allows the user to determine the number of organism that will have one of the three genotypes. A higher frequency of homozygous recessive individuals will be entered if the detrimental characteristic is especially prevalent among the species. Then the animals are allowed to mate at random with a member of the opposite sex. Two arrays, arrayfemale and arraymale, contain elements that are objects of the class organism. By choosing a random number between one and the total number of females or males present (this number corresponds with the elements number in the array), the parents of the offspring are determined. The genotype of each of the parents will determine the genotype of the offspring. Each allele from a parent has an equal chance of being expressed, in other words each allele from one parent has a one in two chance of being expressed. Choosing a random number between zero and one, being one or the other and assigning the value to the homozygous of heterozygous allele, achieves this random chance in the program. Zero represents a recessive allele while one represents the dominant allele. However if the parent is homozygous the parent must pass on the dominant allele if the parent is homozygous dominant and the recessive allele if the parent is homozygous recessive. The program will inform the user of the success rate of the allele by showing which organisms present have homozygous recessive, homozygous dominant, or heterozygous genotypes.