Welcome to the CS section! I’m glad you’re here! This exercise was an introduction to printing text in Java, a nice introduction to creative computing.
This is a program that uses static arrays and a random generator that selects a color, size, and position for stars in a display. This assignment uses trigonometry to create the star shape, an experience I found to be intellectually challenging. When working in the graphics class in Java, we have to treat drawing shapes like how we would be graphing equations; you need to create the equation to graph the shapes you need. There were two methods I found: parametric equations and the point-by-point method. Since I was yet to learn parametric equations in Math Modeling, I used the point-by-point method, which I go through in the code listed here:
These exercises were aimed towards the concept of array lists in Java. Array lists is a system containing data that can have a dynamic size by adding and removing data. We can use Array Lists to store the names of people as strings, or – as shown by the final exercise starting on line 75 — simulate a game of Bulgarian Solitaire. Bulgarian Solitaire is a one-player game with piles of cards. You start with several piles with a certain number of cards. Every turn, you take one card from every pile and put the cards together to form a new pile. A pile is discarded if it runs out of cards. In this case, we start with a triangular number as our total number of cards. With a triangular number, the pattern will eventually result in consecutive pile sizes, like 1, 2, 3, 4, etc. The code on line 75 is a simulation of that, allowing the user to shorten a process that would’ve taken a couple minutes - hours to complete to only a few seconds.