In a population, the birth rate and death rate are calculated as follows: Birth Rate= Number of Births + Population Death Rate Number of Deaths + Population For example, in a population of 100,000 that has 8,000 births and 6,000 deaths per year, Birth Rate = 8,000 ÷ 100,000 = 0.08 Death Rate = 6,000 ÷ 100,000 = 0.06 Design a Population class that stores a current population, annual number of births, and annual number of deaths for some geographic area. The class should allow these three values to be set in two ways: by passing arguments to a three- parameter constructor when a new Population object is created or by calling the setPopulation, setBirths, and setDeaths class member functions. The class should also have getBirth Rate and getDeathRate functions that compute and return the birth and death rates. Your program should properly use pointer data types where appropriate. Write a program that uses the Population class and illustrates its capabilities. Input Validation: If a population figure less than 2 is passed to the class, use a default value of 2. Population must be greater than zero. If a birth or death figure less than 0 is passed to the class, prompt user to type in a positive Sample Output: Enter total population: 100000 Enter annual number of births: 8000 Enter annnual number of deaths: 6000 Population Statistics 100000 0.080 0.060 Population: Birth Rate: Death Rate: Press any key to continue Enter total population: -1 Value must be greater than 0. Please re-enter: 1 Enter annual number of births: -1 Value cannot be negative. Please re-enter: 0 Enter annnual number of deaths: 1 Population Statistics Population: Birth Rate: Death Rate: Press any key to continue. 2 0.000 0.500 Points deducted will be at discretion of professor but all exams will be given the same grading consideration. Let's say 5 exams do not include any documentation/comments in the code, then same amount of points will be deducted on all 5 exams. Some tasks will carry more weight than other tasks. Read problem definition above and evaluate what programming concepts... (hint... the use of classes and objects... use of class functions, etc.)... in this case... will obviously carry more weight than adding, for example, comments/documentation to your programming code.
In a population, the birth rate and death rate are calculated as follows: Birth Rate= Number of Births + Population Death Rate Number of Deaths + Population For example, in a population of 100,000 that has 8,000 births and 6,000 deaths per year, Birth Rate = 8,000 ÷ 100,000 = 0.08 Death Rate = 6,000 ÷ 100,000 = 0.06 Design a Population class that stores a current population, annual number of births, and annual number of deaths for some geographic area. The class should allow these three values to be set in two ways: by passing arguments to a three- parameter constructor when a new Population object is created or by calling the setPopulation, setBirths, and setDeaths class member functions. The class should also have getBirth Rate and getDeathRate functions that compute and return the birth and death rates. Your program should properly use pointer data types where appropriate. Write a program that uses the Population class and illustrates its capabilities. Input Validation: If a population figure less than 2 is passed to the class, use a default value of 2. Population must be greater than zero. If a birth or death figure less than 0 is passed to the class, prompt user to type in a positive Sample Output: Enter total population: 100000 Enter annual number of births: 8000 Enter annnual number of deaths: 6000 Population Statistics 100000 0.080 0.060 Population: Birth Rate: Death Rate: Press any key to continue Enter total population: -1 Value must be greater than 0. Please re-enter: 1 Enter annual number of births: -1 Value cannot be negative. Please re-enter: 0 Enter annnual number of deaths: 1 Population Statistics Population: Birth Rate: Death Rate: Press any key to continue. 2 0.000 0.500 Points deducted will be at discretion of professor but all exams will be given the same grading consideration. Let's say 5 exams do not include any documentation/comments in the code, then same amount of points will be deducted on all 5 exams. Some tasks will carry more weight than other tasks. Read problem definition above and evaluate what programming concepts... (hint... the use of classes and objects... use of class functions, etc.)... in this case... will obviously carry more weight than adding, for example, comments/documentation to your programming code.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 5PE: Using classes, design an online address book to keep track of the names, addresses, phone numbers,...
Related questions
Concept explainers
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Question
Kindly solve in C++ language
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning