code: public static double geometric(int k, double p) {
          if(k<=0 || p<0) {
              throw new IllegalArgumentException("All the parameters must be positive.");
          }
          
          double probability = Math.pow(1-p,k-1)*p;
          
          return probability;
      }
docs: Returns the probability that the first success requires k trials with probability of success p
  
  @param k
  @param p
  @return