Answer to Question #93408 in C++ for mandy

Question #93408
Define c++ function CalculateYears() that stimulates the population growth and return the year in which female will be greater than or equal to male population if the currently we have 1750000 male at growth rate is 25% and 1500000 female at thegrowth rate is 35%
1
Expert's answer
2019-08-27T04:50:52-0400
int CalculateYears()
{
	int result = 0;

	const int maleCount = 1750000;
	const int femaleCount = 1500000;

	int maleCurrentCount   = maleCount;
	int femaleCurrentCount = femaleCount;

	while (femaleCurrentCount < maleCurrentCount)
	{
		++result;

		femaleCurrentCount += (femaleCurrentCount / 100.0 * 35.0);
		maleCurrentCount   += (maleCurrentCount / 100.0 * 25.0);
	}

	return result;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS