I'm writing a program that determines the population of the world between years 1975 to 2006. I found an equation for the world pop and i put it in my code, but i keep getting a '.class' expected. Can anyone help???
--Cassie
P.S: The error is where pop is defined. (pop = 4 * double pow(e, t); )
import TerminalIO.KeyboardReader;
class WorldPop {
public static void main(String args[]) {
KeyboardReader reader = new KeyboardReader();
char answer;
int year;
double pop;
double e = 2.71828183;
double t = 0.019*(year - 1975);
System.out.println("This program computes the World Population from 1975 to 2006.");
System.out.println("Would you like to run this program?");
answer = reader.readChar();
while(answer == 'y') {
System.out.println("Enter the year.");
year = reader.readInt();
pop = 4 * double pow(e, t);
System.out.println("The population in " + year + " is " + pop);
System.out.println("Do you wish to re-run this program?");
answer = reader.readChar();
}
}
}