联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp2

您当前位置:首页 >> Java编程Java编程

日期:2021-01-26 11:46

Birth Rate = No. of Births + Population

Death Rate = No. of Deaths + Population

For example, in a population sample of 200,000 that has 16,000 births and 12,000 deaths per

year, the birth rate and death rate are calculated as follows:

Birth Rate = 16,000 / 200,000 = 0.08

Death Rate = 12,000 / 200,000 = 0.06

Create a class Population that stores the data for the current population, annual no. of

births, and no. of deaths for a period of time. Member functions should return the birth rate and

death rate. Implement the class in a driver program.

? f_Name

? l_Name

? address

? city

? state

? zip

? phone

Write the appropriate mutator (set) and accessor (get) functions for these member

variables.

Next, create a class named UnifiUser, which is derived from the class UserProfile.

The UnifiUser class should have the following member variables:

? customerID

? subscribe

The CustomerNumber variable will be used to hold a unique integer for each customer. The

subscribe variable should be a bool. It will be set to true if the customer wishes to

subscribe the mailing list. Write appropriate mutator (set) and accessor (get) functions

for these member variables. Demonstrate an object of the UnifiUser class in a complete

program.

Note: you may solve this question using abstraction technique or in a single .cpp file.

Question 1:

Suppose the birth rate and death rate in Malaysia are calculated as given below:

Input Validation: Implement appropriate input validations and display error message(s) for

invalid inputs.

Question 2:

Create a class named UserProfile with the following member variables:

Page 2 of 2

Create a class ProjectScore. The constructor of the class should first accept an array of

project scores as its argument. The constructor may initialize or take user input only for 2 or 3

students and suppose the project has 5 modules to enter the score. The class should have a

member function to calculate the average project score for each student. The range of score is

from 1 – 100, and the program should throw an exception in case of invalid score. Write a

driver program to test the functionality.

Write a template for the function named accumulator. The function should receive only

one argument which will determine the no. of values to be read (may be 4 or 5). It should then

accumulate (add) the values entered by the user, and then return the sum of values in the main

function. Test the template in a driver program by sending various types of arguments such as

int, float, double etc., and display the results.

Question 3:

Question 4:


版权所有:留学生编程辅导网 2018 All Rights Reserved 联系方式:QQ:99515681 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。