Hosoya Triangle in java
<p>Objective: Individually, create a recursive representation of Hosoya’s triangle.</p>

<p>Your task:  Haru Hosoya, a famous mathematician described a triangle (seen below) which is a triangular arrangement of numbers based on the Fibonacci numbers.  Get a height from the user and use an array to store the values on each line.  Print out the appropriate number of levels of Hosoya’s triangle using a recursive method.  Do NOT assume that the input will be good.  You should also implement try…catch blocks to catch erroneous input.</p>

<p>Here is the code I have so far:</p>

<pre><code>public class HosoyaTri {

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        boolean continueLoop = true;
        int num = s.nextInt();
        do {
            try {
                System.out.println("How many levels?");

                System.out.println(num + " levels");
                continueLoop = false;
            } catch (InputMismatchException im) {
                System.err.println("I said INTEGER, try again");
                s.nextLine();
            } catch (Exception e) {
                System.err.println("What did you do?");
            }
        } while (continueLoop);
        int triangle[][] = new int[num][num];
        for (int i = 0; i &lt; num; i++) {
            for (int j = 0; j &lt; num; j++) {
                triangle[i][j] = 0;
            }
        }
        for (int i = 0; i &lt; num; i++) {
            triangle[i][0] = 1;
        }
        for (int i = 1; i &lt; num; i++) {
            for (int j = 1; j &lt; num; j++) {
                triangle[i][j] = triangle[i - 1][j - 1] * triangle[i - 1][j];
            }
        }
        for (int i = 0; i &lt; num; i++) {
            for (int j = 0; j &lt;= i; j++) {
                System.out.print(triangle[i][j] + " ");
            }
            System.out.println();
        }
    }

}
</code></pre>
