Question: Program Overview The goal of this assignment is to create a partial model of a population system, emulating the aging and dying of a population.

Program Overview The goal of this assignment is to create a partial model of a population system, emulating the aging and dying of a population.

Program Requirements Create the three classes described below. Use the main() function included below.

Your output should look like that shown below.

Class Descriptions The Date class is used to represent calendar dates.

As a minimum, the class must contain: 3 unsigned int data members to represent month, day, and year a default constructor a constructor that takes 3 unsigned ints as arguments an increment function that adds 1 day to the Date

. The increment function will need to implement leap year logic.

a function to determine an age. For determining ages, you can assume that a year is 365.25 days long

. a display() function that displays the Date in the mm/dd/yy format a letTimePass() function that adds a random number of days to a Date.

The random number should be between 1 and 365.

You will be using this function to add days to the (global) Today Date. Hint: you might use the random number to call the increment() function repeatedly.

The Human class must contain at least: 3 data members: string name Date birthday bool alive a constructor: human(const string& n, const Date& b) necessary accessor functions a function, age() that returns a Humans age in years a die() function (you know what that means) a display() function The Population class must contain: Two data members: Human** people unsigned size A constructor A destructor A display() function An examinePopulation() function that takes a look at the population, calls the following rollTheDice() function for each living Human. If rollTheDice() returns a number greater than .5, the Human should die. float rollTheDice(unsigned short age) { return static_cast(age)*(rand()%100)/10000.; } Assumptions All humans were "born" on or after January 1, 1917. For the Date constructor with 3 unsigned int arguments between 0 and 99. You may assume that a year argument > 16 is occurs is between 1917 and 1999 and a year argument < 17 is between 2000 and 2016. You may use the following global variables in your solution: Date TODAY; // Make sure you define this after your define the Date class unsigned DaysPerMonth[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; string NAMES[] = { "Joshua","Kyle","Yuxi","Anthony","Michael","Samuel","Karlen","Seyed Nima", "Mega Hartati Surya","Tamuz","Ali","Kiet","Khang","Quang","Rafael","David", "Shenghao","Nahom","Johnny","Coriena","Minh Quan","Hong Yip","Robert", "Yingqi","Zheyue","Shun","Dekel","Yash","Shuo","Shiyu","Waddah Adel H", "Tristan","Carlo","Jason","Thao","Joe" }; The main() function You are required to use this main(): int main() { const int OriginalPopulationSize = 36; srand(time(NULL)); Population World(OriginalPopulationSize); World.display(); // let time pass until half of the world's Population dies do { TODAY.letTimePass(); World.examinePopulation(); } while (World.getNumberLiving() > OriginalPopulationSize/2); World.display(); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!