写一个能计算一个数字的卡塔兰数的java程序。卡塔兰数Cn:(2n的阶乘)/((n+1)的阶乘·n的阶乘)
具体解释参考维基百科.
当n = 0, 1, 2 ,3,4,5,.....时
  C = 1, 1, 2, 5, 14, 42,.....阶乘:N的阶乘:1-当n=0或者1时 N的阶乘为1,2-当n>1时,N的阶乘=n·(n-1)的阶乘。
0! = 1 
1! = 1 
2! = 2 . 1 = 2 
3! = 3 . 2 . 1 = 6 
4! = 4 . 3 . 2 . 1 = 24 程序输出结果:
Which catalan number do you want to calculate (-1 to stop): 
0
n = 0: catalan number is 1
Which catalan number do you want to calculate (-1 to stop): 
1
n = 1: catalan number is 1
Which catalan number do you want to calculate (-1 to stop): 
2
n = 2: catalan number is 2
Which catalan number do you want to calculate (-1 to stop): 
3
n = 3: catalan number is 5
Which catalan number do you want to calculate (-1 to stop): 
8
n = 8: catalan number is 1430
Which catalan number do you want to calculate (-1 to stop): 
-3
Invalid input: 
Valid input range is an input >= 0 Which catalan number do you want to calculate (-1 to stop): 
-1
(program exits)
大致意思就是当你输入数字0时,显示n=0 卡塔兰数为1,以此类推当你输入数字3时,显示n=3 卡塔兰数为5. 程序需要有处理异常的能力,当你输入一个无效的数字时,需要提示无效信息。(注意当输入-1时,结束程序)程序需要编写2个文件,Catalan.java 和 CatalanDemo.java. 下面是老师给的框架:(程序中卡塔兰数的算法不清楚怎么算)
===========================================
/* Catalan.java
 * Contains 2 methods factorial and cata
 * 
 *
 * catalan calculates the n-th catalan number 
 * factorial calculates the factorial recursively
 * Receive:  n
 * Return:   n-th catalan number
 ***********************************************************/
public class Catalan
{
  private long factorial(int n){    // fill in code    
    
  }  public long calCatalan(int n)
  {
    // fill in code    
      }}=============================================================
/* 
 * Calculates the value of a specific Catalan number
 * 
 * Input: integer value
 * Output: n-th Catalan number
 ********************************************************/public class CatalanDemo
{
   
  public static void main(String[] args)
  {
    // insert code
  }
}