Ok so I am studying Java for the first time and am really stuck on the following program.

The population of a town is now at 15000 and it is expanding at 5% per year . Write a program to determine how many years it will take for the population to exceed 85000.

I understand mathematically how you get the answer but not in java.

Can anyone help me, please

Below is my lousy attempt :)

import java.util.*;

population

{

//The population of a town is now at 15000 and it is expanding at 5% per year . Write a program to determine how many years it will take for the population to exceed 85000.

public static void main(String[] args)

{

Scanner sc = new Scanner(System.in);

// variables

double population, year1, year2, yearn;

final DOUBLE ENDPOP = 85000;

// initialise loop control variable

while (population < ENDPOP)

{

// year 1 population increase

System.out.println("enter current population");

population = sc.nextDouble():

year1 = (population * 1.05);

year2 = (year1 * 1.05);

yearn = (year(n-1) * 1.05);

} // end while

System.out.println("Number of years for population to exceed 85000 is " + ?);

}// end main

}// end class