Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

help with Java expression



I am having trouble findingwhat is causing the illegal start of expression. Here is the code:

import java.lang.*;
import java.io.*;
import java.math.*;
import java.text.DecimalFormat;
public class jimmcdHomework4
{
   static BufferedReader keyboard = new
            BufferedReader(new InputStreamReader(System.in));

   public static void main(String[] args) throws IOException
   {


   double P;
double B;
double D;
double GR;
double EP;
double growthRate;
double estimatedPopulation;
   int n;

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


   System.out.println();
   System.out.flush();

   System.out.print("Enter the population on the first day of the year : ");
   P= Double.parseDouble(keyboard.readLine());
   System.out.flush();
   System.out.print("Enter birth rate : ");
   B= Double.parseDouble(keyboard.readLine());
   System.out.flush();
   System.out.print("Enter Death rate : ");
   D= Double.parseDouble(keyboard.readLine());
   System.out.flush();
   System.out.print("Enter number of years : ");
   n= Integer.parseInt(keyboard.readLine());


   estimatedPopulation = EP;
   growthRate = GR;






   System.out.println();
   System.out.println("growth rate: " + growthRate);
   System.out.println("estimated population  : " + estimatedPopulation);

   System.out.println();





           if (B < 0)
              {
              System.out.println("birth rate is invalid " );
              System.exit(0);
             }
           else
              if (D < 0){

                System.out.println("death rate is invalid ");
                System.exit(0);
         }
   else
        {
           if (P < 2)
                {
                    System.out.println("population less than 2 not accepted " );
                    System.exit(0);
             }
     



   public static double growthRate(double B, double D)
{
double B;
double D;
double GR;
            

       {
         GR = B - D;
       }

         return GR;

  }



  public static double estimatedPopulation(double P, double GR, int n)
    {
       double P, GR, EP;
       int n;
       {

        EP = n(P + (GR)*P/100);
      }

    return n;
    }
}