answersLogoWhite

0

import java.io.*;

class population

{

private int P,X;

population(int a,int b)

{

P=a;

X=b;

}

private void gr()

{

int c=100+X;

P=(P*c)/100;

}

protected static void main()throws IOException

{

BufferedReader in=new BufferedReader(new InputStreamReader(System.in));

System.out.print("Enter the population at the begining of 1999: ");

int a=Integer.parseInt(in.readLine());

System.out.print("Enter the growth rate: ");

int b=Integer.parseInt(in.readLine());

population o=new population(a,b);

short l=2000;

while(l<2004)

{

o.gr();

System.out.println("Population at the begining of "+l+" : "+o.P);

l++;

}

}}

User Avatar

Wiki User

15y ago

What else can I help you with?