Question: how to get this done! Population Class-Write a class called Population that stores current population, annual number of births, and an annual number of deaths


how to get this done!
Population Class-Write a class called Population that stores current population, annual number of births, and an annual number of deaths for some geographic area with the following specifications: Member Variables - Private Integers to store the current population, number of births, and number of deaths Member Functions Public Default Constructor with no parameters: Initialize Population to 2 and number of births and deaths to 0. Constructor with three parameters. The constructor should be passed the current population, number of births, and number of deaths for the Population object "Set" member function for each of the three member variables. 2 is passed to the class, use a default value of 2. If a birth or death figure less than 0 is passed use a default value of 0. getBirthrate member function. This function should calculate Birthrate based on the following formula: 1. 2. 3. If a population figure less than 4. a. Birth rate Number of Births / Population getDeathrate member function. This function should calculate Birthrate based on the following formula 5. a. Death rate Number of Deaths/ Population Note: As noted in the textbook, generally it is best not to do any input or output in member functions. Testing Write a main function to test your class. Be sure that your output shows that each of your member functions works. Be sure to test with invalid as well as valid data
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
