Started to read the art and science of Java and completing chapter exercises, below is pascals triangle as graphics program. I wanted to use the For loops which create the pyramid in combinations method. For this to work 3 If statements are used. I'm wondering if there is a better method to altering the values of the For loops to get the same outcome. At the moment if the pyramid size is increased in size I would need to add more if statements. Any advice greatly appreciated.
Years ago I made a similar Triangle, with two differences: 1) I let Java do all the centering calculations, and I determined a Pascal value as the sum of the two values above. In case you are interested:
I hate signatures!
posted 1 week ago
Thank you for attaching the way you created Pascals triangle, this has made me realise I have so much more to learn as most of the imports required I have never heard of. Arrays are coming next I will spend time going through your code as this will help with future questions from the book.
Evacuate the building! Here, take this tiny ad with you: