birth rate and death rate are calculated as follows: Number of Births + Population In a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
birth rate and death rate are calculated as follows: Number of Births + Population In a population, the Birth Rate 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 getBirthRate 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 Population: 100000 Birth Rate: Death Rate: 0.080 0.060 Press any key to continue • declaring and using a class • declaring appropriate class member variables • declaring appropriate class constructors • declaring appropriate class mutators ("set" functions) • declaring appropriate class accessors ("get" functions) Enter total population: -1 Value must be greater than 8. Please re-enter: 1 Enter annual number of births: -1 • using appropriate class function prototypes • initializing appropriate variables • passing the right arguments and setting appropriate parameters to accept argument variables • proper execution of program logic Value cannot be negative. Please re-enter: 0 Enter annnual number of deaths: 1 Population Statistics 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. You will be graded on the following programming activities: • declaring preprocessor directives • documentation/comments in your code Population: Birth Rate: Death Rate: Press any key to continue. 2 0.000 0.500 • appropriate use of C++ syntax • appropriate use of input and output techniques appropriate use of if statements appropriate use of looping statements • appropriate use of formulas to compute birth/death rates • declaring/using appropriate variables/data types • declaring and creating object(s) • calling class variables and using class functions through objects • appropriate use of validation techniques • the use of fixed, showpoint, setprecision(), setw() • displaying appropriate output on screen (see above) • Also, points (up to 30 pts) will be deducted if program does not compile. Make sure your program compiles and runs. Remember, if you're missing just one semicolon, program may not compile. birth rate and death rate are calculated as follows: Number of Births + Population In a population, the Birth Rate 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 getBirthRate 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 Population: 100000 Birth Rate: Death Rate: 0.080 0.060 Press any key to continue • declaring and using a class • declaring appropriate class member variables • declaring appropriate class constructors • declaring appropriate class mutators ("set" functions) • declaring appropriate class accessors ("get" functions) Enter total population: -1 Value must be greater than 8. Please re-enter: 1 Enter annual number of births: -1 • using appropriate class function prototypes • initializing appropriate variables • passing the right arguments and setting appropriate parameters to accept argument variables • proper execution of program logic Value cannot be negative. Please re-enter: 0 Enter annnual number of deaths: 1 Population Statistics 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. You will be graded on the following programming activities: • declaring preprocessor directives • documentation/comments in your code Population: Birth Rate: Death Rate: Press any key to continue. 2 0.000 0.500 • appropriate use of C++ syntax • appropriate use of input and output techniques appropriate use of if statements appropriate use of looping statements • appropriate use of formulas to compute birth/death rates • declaring/using appropriate variables/data types • declaring and creating object(s) • calling class variables and using class functions through objects • appropriate use of validation techniques • the use of fixed, showpoint, setprecision(), setw() • displaying appropriate output on screen (see above) • Also, points (up to 30 pts) will be deducted if program does not compile. Make sure your program compiles and runs. Remember, if you're missing just one semicolon, program may not compile.
Expert Answer:
Related Book For
Fundamentals of Electric Circuits
ISBN: 9780073301150
3rd edition
Authors: Matthew Sadiku, Charles Alexander
Posted Date:
Students also viewed these computer engineering questions
-
Use the distributions from Exercise 1 to answer the following questions. a. What is the probability that an individual student will be taller than 180 centimetres? b. Suppose a random sample of 25...
-
Refer to Exercise 1 and answer the following questions: a. Given that X = 1, determine the conditional pmf of Y-i.e., pY | X(0 | 1), pY | X(1 | 1), and pY | X(2 | 1). b. Given that two hoses are in...
-
(a) What is the definition of cash? (b) What is the definition of securitization? (c) What are the three contexts that give rise to recourse?
-
When a parameter is changed, does this affect the argument that was passed into the parameter?
-
Visit a local marketing research firm. Find out how the sample sizes were determined in some recent surveys or experiments. Write a report about your findings.
-
Do the same problem as described in Programming Exercise 4, except make it a template function: template int reduce(T ar[], int n); Test the function in a short program, using both a long...
-
International Publishing Company has the following selected account balances at June 30, 2007. Prepare the stockholders" equity section of International's balance sheet. Inventory $112.000 Common...
-
On page 243, we presented a frequency distribution for data on chest circumference, in inches, for 5732 Scottish militiamen. As mentioned there, Adolphe Quetelet used a procedure for fitting a normal...
-
If the average wait time is 17 minutes with a standard deviation of 4 minutes, determine the percentage of patrons who wait less 20 minutes for their main course to be brought to their tables
-
Mack Banta, a nonexempt account representative, worked extra hours this week as a call operator. A number of operators were out for the week and Banta was asked to pick up some of their hours. Can...
-
An investor has considerable investment knowledge, with a high risk tolerance. Although the investor had success with self-directed investment strategies, they acknowledge that professional managers...
-
Which ONE of the four goals you are choosing from Attenborough's list What problem are you solving? A specific and realistic goal you would like to achieve that solves that problem A plan on how we...
-
100 5 (1) WO Logistics Processes Business Case Assignments Throughout Logistics Processes, you will submit three critical responses from the viewpoint of working for a subject company. This...
-
1. The maximum pressure an eardrum can withstand without rupturing is Pmax = 3.0102 Pa. Assume a sound is made at that pressure. If the density of air is, p=1.20 kg/m, and the speed of sound is 340...
-
The players play this game infinitely many times, and each discounts the future using a discount factor d < 1. Consider first a pair of Grim-Trigger (GT) strategies, as in class: players play C as...
-
Answer any ten of the following: (") Calculate the wavelength of an electron of energy 10 eV. (in) Why do not we observe the de Broglie wavelength with a fast moving cricket ball? (1) What is the...
-
Swifty Company has an old factory machine that cost $52,000. The machine has accumulated depreciation of $29,120. Swifty has decided to sell the machine. (a) Prepare a tabular summary to record the...
-
(a) Bright Sdn Bhd (BSB) is a tax resident manufacturing company in Johor, which involves in ceramic tiles. Currently, BSBs annual sales turnover has been forecasted to be around RM 300,000 for the...
-
For the circuit shown in Fig. 19.129, use PSpice to obtain the t parameters. Assume Ï = 1 rad/s. j2 152 1S2 1 -200
-
Find v(t), t > 0 in the circuit of Fig. 16.40. Let v s= 20 V. t 0 10 2 v100 mF)
-
The current through a 12-mH inductor is 4 sin 100t A. Find the voltage, and also the energy stored in the inductor for 0 < t < /200 s.
-
Name the six matters the auditor often considers in obtaining an understanding of the control environment.
-
In a general sense, why does the auditor acquire an understanding of the internal control structure?
-
Explain the relationship between the audit strategy and the necessary level of understanding of the internal control structure.
Study smarter with the SolutionInn App