Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please write the script.Thank you. An interesting property of the male honeybee is that it only has a single parent. This situation arises because a
please write the script.Thank you.
An interesting property of the male honeybee is that it only has a single parent. This situation arises because a female honeybee is able to lay eggs that may or may not have been fertilized by a male honeybee. If a female honeybee lays an egg that has not been fertilized by a male, the result will always produce a male honeybee. If, on the other hand, a female honeybee lays an egg that is fertilized by a male, the result will always produce a female honeybee. A female honeybee always has two parents, whereas a male honeybee only has a single (female) parent. A local apiarist (beekeeper) wants you to build a computer program that will allow her to determine the number of ancestors of a given male honeybee in a given ancestral generation. She inherited an apiary from her great-great-grandparents (who were meticulous record keepers) and wants t inherited attributes among the honeybees within her hives. ing genetic analysis of certain Figure 1 depicts the ancestry of a single male honeybee to three ancestral generations. Each vertex in the figure represents a honeybee. Each vertex is labeled with the gender and generation number of the honeybee. For example, the vertex labeled Mo in Figure 1 represents a honeybee from the current (or o generation, and each vertex labeled F in Figure 1 represents a third-generation female ancestor of the honeybee Mo Build a C++ program that will allow the apiarist to determine the number of ancestors of a male honeybee in a given ancestral generation. Your program shall allow the apiarist to input the number of the generation that she wants to determine the size of The apiarist has specified that she will only want to determine the number of ancestors for at most 25 ancestral generations. Your program shall validate user input, so if the user accidently enters an ancestral generation number less than 0 or greater than 25 your program shall print a message indicating the error and immediately terminate Figure 1: Ancestry of Single Male Honeybee to Four Generations Figure 2 is an example of how your program should operate for the inputs specified Please make sure to follow this example as elosely as possible, beeause the apiarist is quite particular about what she wants bash 4-10 /hw1 Enter ancestral generation number: 2 Ancestral generatlon 2 eontains 2 honeybees bash 4-1 -/hwl Ancestral generation eontains 1 honeybee Enter ancestral generation number: 26 EErOE input is less than 0 or greater than 25 Enter ancestral generation number: 3 Ancestral generation 13 eontains 377 honeybeesStep 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