Question: Function in c + + language Weight on Another Planet: The weight of any object on a planet depends on both the radius and the

Function in c++ language
Weight on Another Planet: The weight of any object on a planet depends on both the radius
and the mass of the planet itself, but the formula becomes very easy if you start with the
objects weight on Earth. For example,
for Venus, multiply the weight on Earth with 0.905
for Mars, multiply with 0.3787
for Jupiter, multiply with 2.53
Write a function named calculateWeight that accepts the name of the planet and an objects
weight on Earth as arguments, and returns the weight on that planet. Demonstrate the
function by calling it in a program that asks the user to enter values for the planet and the
weight.
Population: In a population, the birth rate is the percentage increase of the population due to
births, and the death rate is the percentage decrease of the population due to deaths. Write a
program that displays the size of a population for any number of years. The program should
ask for the following data:
The starting size of a population
The annual birth rate
The annual death rate
The number of years to display
Write a function that calculates the size of the population for a year. The formula is
N = P + BP DP
where N is the new population size, P is the previous population size, B is the birth rate, and
D is the death rate.
Input Validation: Do not accept numbers less than 2 for the starting size. Do not accept
negative numbers for birth rate or death rate. Do not accept numbers less than 1 for the
number of years.

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!