This simple game demonstrates more class / object inheritance along with showing how abstract and sealed classes work together. Along with my previous programs on using arrays to store data. You will notice from the class designer picture that the RoundPopper, StringPopper, and RectanglePopper classes all derive from the Popper abstract class. Also the OvalPopper derives from the RoundPopper classes while deriving from the OvalPopper class. I know more complicated that it needs to be. I just did it this way to show the inheritance concepts.
This is my little version of the old school Microsoft Paint program with only a few features. My plan is to add more in later versions. But for right now I’m showing this to demonstrate how object classes and class relationships can work in a simple form. You will notice from the class designer picture that the Line, Rctangle, and Elipse class all derive from the Shape class. The Shapes class is instantiated in the Mainform class. The Shapes class uses a one-dimensional array to store what is drawn on the screen. I do have to admit that working with graphics is a little more difficult for me. I’m used to just gathering data and performing tasks on it. So this is a fun project to expand my horizons.
Click on more to see the source code.
Do you remember those puzzle games you see in small shops, novelty stores, etc..? You know the ones where you have to slide the pieces around in a frame to get the picture correct? This game resembles one of those. That and it demonstrates how to index and sort an array. This game has the option of increasing the difficulty by making the board have more pieces. Don’t worry you can also view the completed puzzle to help out. Kind of like doing a regular puzzle at home. You can look at the box. You can also select a new puzzle and a new one will be randomly selected for you. I’ll be adding / changing the code to this game as time goes on. On keep an eye on the source.
This was a program that gave you a random list of arithmetic problems. You would drag the math problem from the left-side to the correct answer on the right-side. Each answer was stored in a two-dimensional array. This program taking advantage of one-dimensional, two-dimensional, and jagged arrays. I realize you can do more with and Array List or Collections. I just wanted to see what would need to happen is I chose to use arrays instead. I might re-write this later using Collections instead simply for the ease of coding. That and adding more arithmetic problems and answers. Here’s the source.