Question: 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

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: 1. Default Constructor with no parameters: Initialize Population to 2 and number of births and deaths to 0. 2. Constructor with three parameters. The constructor should be passed the current population, number of births, and number of deaths for the Population object. 3. Set member function for each of the three member variables. If a population figure less than 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. 4. getBirthrate member function. This function should calculate Birthrate based on the following formula: a. Birth rate = Number of Births / Population 5. getDeathrate member function. This function should calculate Birthrate based on the following formula: 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.

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!