1. Engineering
  2. Computer Science
  3. activity 61 imagine all the people worldwide population continues to...

Question: activity 61 imagine all the people worldwide population continues to...

Question details

Activity 6.1: Imagine All the People

  • Worldwide population continues to grow every year [1]. One model for projecting the growth is given by the equation:

    population = 7.35 · e 0.0071 (Year - 2016)

  • which reports the results in billions.
  • The letter e in the above formula is the mathematical symbol for Euler's number, the base of the natural logarithms.
  • To calculate this exponent in Java, you will need to use the Math.exp() method from java.lang.Math.
  • Add a block comment at the top of your program with your name and section information.

    /*

    * @author first name last name

    * Section info

    */

  • Write a program that requests a year from a user and displays the estimated population for that year as shown in the Example Run below.
  • You must name the source code file PopGrowth.java.
  • Create a new Scanner variable at the top of your program, named input.
  • Then, declare a new integer variable called year.
  • Prompt the user to enter the year for which they wish to calculate the world population.
  • Calculate the population for the year using the formula for population shown above.
  • Use the Math.exp() method from java.lang.Math to calculate the power of e (Euler's number).
  • Example Run: The outputs of the program must look like the following for you to receive full credit. For the input shown (2020) you must get the same output. However, the output numbers must change if the inputs are different.
    Enter the year: 2020
    Estimated worldwide population in 2020: 7.561732368586969 billion
    
  • Use the default formatting and precision for the numbers -- do NOT add any numerical formatting statements to the code.
  • When your program works identically to the example output above, submit PopGrowth.java.
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution