Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

As the problem indicates, assume the population of the U.S. at the moment your s

ID: 3786443 • Letter: A

Question

As the problem indicates, assume the population of the U.S. at the moment your starts is 312, 032.486. Your program should display the projected population exactly one year from the moment, your program started, the projected population exactly two years from the moment your program started, etc. up to five years from the moment your program started. (Population projection) The U.S. Census Bureau projects population on the following assumptions: One birth every 7 seconds One death every 13 seconds One new immigrant every 45 seconds Write a program to display the population for each of the next five years Assume the current population is 312.032.486 and one year has 365 days.

Explanation / Answer


public class Hw {

    public static void main(String[] args) {
      
        long in_pop=312032486;
        long pop=in_pop;
      
       double births_in_a_day=24*60*60/7.0;
       double deaths_in_a_day= 24*60*60/13.0;
       double immigrants_in_a_day=24*60*60/45.0;
       long d1,d2,d3;
     
       d1=Math.round(births_in_a_day*365);   // total births in a day
       d2=Math.round(deaths_in_a_day*365);   // total deaths in a day
       d3=Math.round(immigrants_in_a_day*365);   // total immigrants in a day
       for(int i=1;i<=5;i++)
       {
         pop=pop+d1-d2+d3;
         System.out.println(" Population after "+i+" year: "+pop);
       }
     


}}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote