I am supposed to have 3 methods.
One should print the whole triangle at the end, one should solve the next row, and one should print the next row, which was the previous method.
I'm not good with arrays and am really confused on how to start. They only thing I could do was a getAuthor method.
My teacher wants us to do it with singular arrays.
I guess if you want to see what my teachers main looks like i can paste it here. the 10 and the 15 in the parameters are the number of lines/rows that should be printed.
Thanks
here is the main
package package04B;
public class PascalsTriMain {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(" Pascal's Triangle printed by " + PascalsTri.getAuthor());
PascalsTri.printTri(10);
System.out.println();
PascalsTri.printTri(15);
}
}______________________________________…
here is my own code. not to good I know. Im not so good with arrays, actually half my class is failing cause our teachers is terrible, but i dont want to bail on the class since its IB
/**
*
*/
package package04B;
/**
* @author *******
*
*/
public class PascalsTri {
public static String getAuthor() {
return getAuthor();
}
public static void printTri(int){
}
private static int[] nextRow(int[]){
}
private static void printRow(int[]){
}
}_____________________________________
I have the author method down, for next row, i am positive that I am supposed to set up an array with the first and last positions always set at 1
then i have to ask printRow method for the previous triangle (ignore that if its the first row) and add up the first two integers. then add one to the position and add the 2 and 3 and so on. then return the row to printRow method
then repeat the task until the parameters say so which is 10 and 15 as said before in my teachers main. I Know what i want to do, the problem is putting it into code.

Help

Back to top










