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

Background We are going to estimate the population of the United States based on

ID: 3542255 • Letter: B

Question


Background

We are going to estimate the population of the United States based on some information found at a website provided by the US census: http://www.census.gov/popclock/

That website specifies the following information:

How many years:0 New population in 0 years will change by 0 to be 307357870 How many years:1 New population in 1 years will change by 2980324 to be 310338194 How many years:10 New population in 10 years will change by 29803252 to be 337161122 How many years:100 New population in 100 years will change by 298032527 to be 605390397

Explanation / Answer



import java.util.*;


class Population

{

public static void main (String[] args)

{

long p =307357870;

long yearsecs = 60*60*24* 365;

double br= yearsecs/7.0;

double dr= yearsecs/13.0;

double ir= yearsecs/35.0;

double change = br-dr+ir;

Scanner s=new Scanner(System.in);

System.out.print("How many years:");

int y = s.nextInt();

long pnew = (long)(y*change);

System.out.println("Now population in "+y+" years will change by "+pnew+" to be "+(p+pnew));

}

}