P = R*P*(1-P)

Input: R (growth rate parameter) Double values between 0 and 10.

Input: P (population) Double values between 0 and 1.

Output: P (New population) on the console in rows of five numbers

the exit conditions are the population becomes extinct or stable.

Extinction occurs when the new value of P is zero.

Stability occurs when the new value of P is the same as the previous value of P.

Hey...okay, I really don't need much coding help for this, but I need some JAVA logic help. Once I understand the logic, I think I'll be able to get it. So basically, I need to create two methods I suppose, but I don't get the basis of this equation at all!!! This seems more like a math problem than a programming problem.

It is.
But you didn't even tell what the problem is.
Do you want to determine values of R for which a given P will yield a stable population?
Or maybe values of P for which a given R will yield a stable population?
Or what exactly do you want?

Once you know that you can start designing your code around that knowledge.

Method( double R, double P){

   P = R*P*(1-P);

   return P;
}

Is this what you want to do ??

You want to set up a loop. Save your initial 'P' value, then feed it back into the equation. Then check the result and determine if it is stable or Extinct.

You can put the below in it's own method called 'Malthusian':

public int Malthusian {
   double saveP;
   double newP;
   boolean bflag = true;
   int returnVal = 0; // Initial value

   // Assuming nano's method above returns a double: 
   saveP = Method(5,1);
   while(bflag) {
      newP = Method(5,saveP);
      if (newP == saveP) {
         // Stable (do what you need to return this.)
         returnVal = 1;  // Arbitrary value to denote Stable
         bflag = false;
      }
      if (P == 0) {
         // Extinct (do what you need to return this.)
         returnVal = 2;  // Arbitrary value to denote Extinct
         bflag = false;
      }
      return returnVal;  // Return the value
   }
}

Granted this is quick and dirty. I am assuming that one or the other value will be reached, but this could also cause an infinate loop.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.